Raku Conference Day 2 on Youtube: www.youtube.com/watch?v=BL9-XdC9WYI 🦋 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 14 August 2022.
ugexe gist.github.com/ugexe/ce581c7cac44...ebe816d97f 00:53
a prototype of the load-from-this-same-dist functionality 00:54
anyone have suggestions to make the `use-from-dist("module-name")` work as `use-from-dist(module-name)`? 00:56
or `use-from-dist module-name`
tib Hi all :) by curiosity, anyone can tell me what is or was "pigeon" (from www.reddit.com/r/linux/comments/3y...context=3) or it was just the word used to talk about "parrot"? 11:40
leont I can't add a COERCE method to a role, can I? 14:56
Mixing in a role { COERCE() { .… }} gives an error because something else is already adding a COERCE as well, I don't know any other escape hatch
Er, I meant add a CEORCE to an enum 14:57
p6steve this code line seems to work as intended ```$obj = sort( $obj: {$obj[$++]<species>, $obj[$++]<mass>})[*].reverse^;``` 15:16
I am a bit nervous that the state var ```$``` is getting incremented twice on each pass ... or is it one state var for each subscript ```[]```? 15:18
p6steve m: my @a = 3,6,5,7;for ^2 { say @a[$++] } 15:26
camelia 3
6
p6steve m: my @a = 3,6,5,7;for ^2 { say @a[$++], '+', @a[$++] }
camelia 3+3
6+6
p6steve looks like the [] subscript delimits the block scope of $ 15:27
Nemokosch I'd like to know the reason for this behavior 15:31
p6steve m: my @a = 3,6,5,7;for ^2 {state $i; say @a[$i++],'+',@a[$i++]} 15:33
camelia 3+6
5+7
Nemokosch . 15:34
tellable6 2022-08-23T10:48:11Z #raku <leont> Nemokosch: It will probably work if you use Getopt::Long 😉
2022-08-27T11:13:01Z #raku <leont> Nemokosch: I will open a ticket as soon as I narrowed it down. It's tricker than I thought
Nemokosch m: for ^2 { ($ ~= 'asd') .WHICH.say; ($++) .WHICH.say; }
camelia Str|asd
Int|0
Str|asdasd
Int|1
Nemokosch oops, bad copy 15:35
leont Very helpul, tellable6
Nemokosch this was simple enough
m: for ^2 { ($++) .WHICH.say; ($++) .WHICH.say; }
camelia Int|0
Int|0
Int|1
Int|1
Nemokosch almost as if they were two different static variables
p6steve I think that may be intentional 15:36
Nemokosch isn't this the same thing that you showed? 15:39
p6steve I think that the independent indexing is useful 15:40
maybe like this
Nemokosch it can be useful, I just don't understand it :D 15:41
p6steve m: my @a = 3,6,5,7;for ^2 { say @a[$++], '+', @a[$+=2] }
camelia 3+5
6+(Any)
Nemokosch umm 15:42
something seems strange
p6steve m: my @a = 3,6,5,7,8,9,2;for ^2 { say @a[$++], '+', @a[$+=2] }
camelia 3+5
6+8
Nemokosch can you comprehend this? because I surely can't 15:44
p6steve looking at this behaviour, I would say for the state var, each index [] "context" is seen as a block scope 15:45
so in my first example, there are two state vars and each increments each time it is touched, so they index the same values 15:46
Nemokosch so far so good 15:47
oh maybe I just miscounted
it just acts like two state variables
but wasn't this the case without indexing as well? 15:48
p6steve yes - just acts like two independent state vars
Nemokosch m: for ^2 { ($++) .WHICH.say; ($ += 2) .WHICH.say; }
camelia Int|0
Int|2
Int|1
Int|4
p6steve I didn't try outside of the index [] 15:49
I did declare state $i in the outer scope and then used it in both indexes (and then $i is shared) 15:50
looks like the () example you just did has single $ also 15:51
alles klar? 15:52
Nemokosch jawohl xd 15:55
lizmat PSA: this week's Rakudo Weekly news will be later today or tomorrow 16:26
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/08/29/2022-35-reworkout/ 20:05
Xliff m: my $*a, $*b = (1, 2); DYNAMIC::.keys.gist.say 20:39
camelia Dynamic variable $*b not found
in block <unit> at <tmp> line 1
Xliff m: my ($*a, $*b) = (1, 2); DYNAMIC::.keys.gist.say
camelia ($_ ::?PACKAGE $=pod $*a $=finish EXPORT $?PACKAGE $¢ GLOBALish $*b $! !UNIT_MARKER $/)
Xliff m: class A { method a { DYNAMIC::.keys.gist.say }; }; my ($*a, $*b) = (1, 2); A.a 20:40
camelia ($! %_ $¢ self $/ $_)
Xliff Why aren't $*a and $*b visible in the second example? 20:41
Xliff m: sub a { DYNAMIC::.keys.gist.say }; my ($*a, $*b) = (1, 2); A.a 20:45
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
A used at line 1
Xliff m: sub a { DYNAMIC::.keys.gist.say }; my ($*a, $*b) = (1, 2); a()
camelia ($/ $¢ $! $_)
japhb Well that explains some weirdness that I thought was just me holding it wrong. 20:48
japhb ... and why I generally handle dynamic variables by setting PROCESS:: keys 20:49
Xliff Example, please? 20:52
japhb: Exanple, please? 20:57
m: class A { method a { DYNAMIC::.keys.gist.say }; }; PROCESS::<$a> = 1; PROCESS:<$b> = 2; A.a 20:59
camelia ===SORRY!=== Error while compiling <tmp>
Preceding context expects a term, but found infix = instead.
Did you make a mistake in Pod syntax?
at <tmp>:1
------> }; }; PROCESS::<$a> = 1; PROCESS:<$b> =⏏ 2; A.a
Xliff m: class A { method a { DYNAMIC::.keys.gist.say }; }; PROCESS::<$a> = 1; PROCESS::<$b> = 2; A.a 21:00
camelia ($/ $_ %_ self $! $¢)
Xliff m: PROCESS::<$a> = 1; PROCESS::<$b> = 2; class A { method a { DYNAMIC::.keys.gist.say }; }; ; A.a
camelia ($/ $_ %_ self $! $¢)
Xliff m: class A { method a { $*a.say; $ *b.say }; }; PROCESS::<$a> = 1; PROCESS::<$b> = 2; A.a
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
b used at line 1
Xliff m: class A { method a { $*a.say; $*b.say }; }; PROCESS::<$a> = 1; PROCESS::<$b> = 2; A.a
camelia 1
2
japhb Sorry, was working $day-job. :-) 21:40
But yeah, I don't generally do DYNAMIC:: introspection, so when I need to set particular variables to be seen anywhere in my code, I just set the PROCESS:: keys as you did with your last example. 21:41
Because PROCESS:: is the final fallback for all dynamic searches.
Guest10 my last name is sud => stupid suicide 22:54
i am mage looking for a priest and healer 22:55
help 22:57
reno911