🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
SmokeMachine coleman: My NATS client (github.com/FCO/nats) has a few tests now, I still do nothing with the data received by servers INFO command and do not pass anything on CONNECT, and many other non implemented features... do you have any suggestion on what should be the next step? 03:21
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/05/29/2023-...t-rolling/ 13:23
Xliff \o 14:20
uzl[m] lizmat++ 15:28
I ~~didn't~~ don't know much about the differences between sigilless and sigilled variables so I created this gist highlighting their differences. Let me know if I'm lying somewhere or completely misunderstanding things haha 15:32
gist.github.com/uzluisf/b3539dbf95...f4646e6c05
lizmat uzl[m]: I wouldn't call [1, 2] a container 15:34
uzl[m] m: my \a := [1, 2]; say a; a = [3, 4]; say a; 15:36
camelia [1 2]
[3 4]
uzl[m] What allows for storing new values into a sigilless once it's been bound to here?
lizmat with sigilless "variables" you create a term to which an object is bound 15:37
lizmat m: my \a = [1,2]; dd a 15:38
camelia [1, 2]
lizmat m: my \a = [1,2]; dd a; a := 42
camelia ===SORRY!=== Error while compiling <tmp>
Cannot bind to 'a' because it is a term and terms cannot be rebound
at <tmp>:1
------> my \a = [1,2]; dd a; a := 42⏏<EOL>
lizmat m: my \a = [1,2]; dd a; a.push(666); dd a
camelia [1, 2]
[1, 2, 666]
lizmat the object that it is bound to, can be mutable, in case of an Array
m: my \a = (1,2); dd a; a.push(666) 15:39
camelia (1, 2)
Cannot call 'push' on an immutable 'List'
in block <unit> at <tmp> line 1
lizmat but if it is not mutable, you cannot change the contents of that object
m: my \a = my $; a = 42; say a
camelia 42
uzl[m] So the object is mutable but it's not a container, right? I think this makes sense but trying to wrap my head around it 15:40
lizmat now, if you bind a container to a sigilless variable, it becomes assignable, because containers *are* assignable
well, the thing you need to realize is that sigilless variables are just objects
uzl[m] What would that look like? Something like my \a := $;?
lizmat if the object in question can be mutated, it is mutable 15:41
my \a = $ would bind the nameless state variable
uzl[m] Right, that makes sense 🤔
Tangentially related, where does Raku borrow the concept of containers from (in this context)? 15:42
lizmat the simplest way to bind a container is the '= my $' trick
good question: it was one of the hardest things I have needed to grok when starting with Raku, coming from Perl 15:43
uzl[m] m: my \s = my $ = 1; say s; s++; say s; 15:44
camelia 1
2
uzl[m] Cool, back in Python land haha
lizmat yup -)
uzl[m] Yeah I haven't tried that many languages but I have never found the concept of containers in the ones I've tinkered with so it's kind of interesting 15:45
Thanks Liz! Happy Memorial Day everyone! 15:47
I'm back to reading Liz's Rakudo Weekly!
tbrowder__ m: my \a = [1,2]; a.push: 3; dd a 19:00
camelia [1, 2, 3]
tbrowder__ my a is an array. wasn't yours a list? 19:01
sorry, i missed the first exmpl, back to sleep, bozo 19:02
lucs Can I obtain the value (if any) of the "-I" command line option from inside my program? 20:27
tbrowder__ m: constant %h = [ a => 1 ]; say %h.WHAT 20:42
camelia (Map)
Xliff lucs: stackoverflow.com/questions/353529...-not-found 21:12
Xliff lucs: That boils down to the following -- $*REPO.repo-chain.grep( * ~~ CompUnit::Repository::FileSystem ).gist.say 21:18
If you want the entire list of include directories, use: $*REPO.repo-chain.map( ~* ).grep( *.starts-with("/") ).gist.say 21:21
lucs Xliff: Nice, thanks. 21:34
Xliff lucs: yw 22:07
lizmat lucs: there's also an undocumented way: 22:19
m: say Rakudo::Internals.INCLUDE
camelia ()
lizmat m: use lib 'lib'; say Rakudo::Internals.INCLUDE
camelia ()
lizmat it's definitely just what is on -I
ugexe -I is not restricted to file system repos 22:21
and you shouldn’t feel the repo chain objects using starts-with expecting paths eithe reslly 22:22
Just $*REPO.repo-chain is sufficient 22:24
why you shouldn’t follow rhose 22:25
Xliff ugexe: Actually, those are stringified CompUnit::Repository objects.
ugexe grep examples is that /foo and file#/foo are the same
Xliff Which will resolve to a path or the name of the class. Hence the .starts-with for things like AbsolutePath, Perl5 and such. 22:26
ugexe I just showed why that is a bad assumption
Xliff m: $*REPO.repo-chain.map( ~* )
camelia ( no output )
Xliff m: $*REPO.repo-chain.map( ~* ).say
camelia (/home/camelia/.raku /home/camelia/rakudo-m-inst-1/share/perl6/site /home/camelia/rakudo-m-inst-1/share/perl6/vendor /home/camelia/rakudo-m-inst-1/share/perl6/core CompUnit::Repository::AbsolutePath<2461569001312> CompUnit::Repository::NQP<24615940821…
ugexe file#/foo is the same as /foo
Your example just shows what some possible values are. You shouldn’t assume those are the only values it could be 22:27
Xliff I'm noit.
ugexe sirry for the typos, my phone is not playing nice
Xliff However in the lack of documentation, this is the best I could get in the time allowed.
No worries. I'm on my keyboard and I get them more than I'd like. 22:28
I was actually hoping the stringified objects would contain the "file#" or "inst#" designation. 22:29
Which CompUnit::Repository method handles that piece of information?
ugexe Ah I see what you are saying, yeah I was wrong about how I thought they would stringify there
I think what is expected of people is to map the repo chain to repo-spec or spec-path or some such method I can’t grep for right now 22:31
maybe it’s .id on the repo 22:35
Xliff m: $*REPO.repo-chain.map( .id ).say 22:36
camelia No such method 'id' for invocant of type 'Any'
in block <unit> at <tmp> line 1
Xliff m: $*REPO.repo-chain.map( *.id ).say
camelia (C76BB82FC7ACA3EB05223CDEDFE6A2A07C8298BD 9DEE4D5C0BAEF261BC738E4CD37D299285F14758 4673D8D2419A42AF180D631AE8A132D0EA08987B B36589A247B3ED3CF56CB3E15D65D79D282CBB49 ap NQP Perl5)
Xliff m: $*REPO.repo-chain.head.^methods.map( *.name ).say
camelia (TWEAK writeable-path can-install name upgrade-repository install uninstall files candidates resolve need resource id short-id loaded distribution installed precomp-store precomp-repository load repo-chain new source-file WHICH Str gist raku next-repo…
Xliff m: $*REPO.repo-chain.map( *.name ).say 22:37
camelia No such method 'name' for invocant of type
'CompUnit::Repository::AbsolutePath'. Did you mean any of these: 'are',
'none', 'note', 'take'?
in block <unit> at <tmp> line 1
Xliff m: $*REPO.repo-chain.map( *.name ).say
camelia No such method 'name' for invocant of type
'CompUnit::Repository::AbsolutePath'. Did you mean any of these: 'are',
'none', 'note', 'take'?
in block <unit> at <tmp> line 1
Xliff m: $*REPO.repo-chain.map( *.?name ).say
camelia (home site vendor core Nil Nil Nil)
ugexe Oh it is path-spec
Xliff m: $*REPO.repo-chain.map( *.?path-spec ).say
camelia (inst#/home/camelia/.raku inst#/home/camelia/rakudo-m-inst-1/share/perl6/site inst#/home/camelia/rakudo-m-inst-1/share/perl6/vendor inst#/home/camelia/rakudo-m-inst-1/share/perl6/core ap# nqp# perl5#)
Xliff Ahh... was hoping to just get the inst or file designation, but that works. Thanks. 22:38
ugexe I think short-id would be just the prefix part 22:39
uzl[m] .seen codesections1 22:40
tellable6 uzl[m], I saw codesections1 2022-03-29T20:41:00Z in #raku: <codesections> I don't have a release date for epee yet, sorry ☹
uzl[m] .tell codesections1 If your RA article (raku-advent.blog/2022/12/20/sigils/), there's this incomplete sentence:
"Or we could group them with curly brackets, which creates a."
tellable6 uzl[m], I'll pass your message to codesections
Xliff ugexe: That it is! I almost missed that one. Thanks! 22:43
m: $*REPO.repo-chain.map( ~* ).grep( *.short-id eq 'file' ) # -I list 22:44
camelia No such method 'short-id' for invocant of type 'Str'
in block <unit> at <tmp> line 1
Xliff m: $*REPO.repo-chain.grep( *.short-id eq 'file' ) # -I list
camelia No such method 'short-id' for invocant of type
'CompUnit::Repository::AbsolutePath'
in block <unit> at <tmp> line 1
Xliff m: $*REPO.repo-chain.grep( *.?short-id eq 'file' ) # -I list
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
Use of Nil in string context
in block <unit> at <tmp> line 1
Use of Nil in string context
in block <unit> at <tmp> line 1
Xliff m: $*REPO.repo-chain.grep({ ( .?short-id // '' ) eq 'file' }) # -I list 22:45
camelia ( no output )
ugexe Welol, you can pass inst# repos or any repo to -I
Xliff Wheee....
I thought -I was only filesystem
ugexe nope
Xliff How would you pass #inst?
Or inst#?
ugexe inst#/path/to/repo typically 22:46
quoted
Xliff Oh. That simple. LOL
ugexe if it’s a named repo (one of the defaults) then inst#site works 22:47
Xliff OK, thanks.
Is any of this documented anywhere?
ugexe No clue 22:49
Xliff OK.
I'll see if I can turn this conversation into something usable in my copious amounts of spare time.
Speaking of which... I think p6-EDS is screaming my name....
Xliff is off on more Adventures of the Quixotic Coder 22:50