🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
elcaro nvm... found a work around... bind the Proxy to `OUR::{'$varname'}` 00:00
00:06 reportable6 left 00:08 reportable6 joined 01:08 benchable6 left, linkable6 left, notable6 left, sourceable6 left, squashable6 left, greppable6 left, reportable6 left, quotable6 left, nativecallable6 left, statisfiable6 left, unicodable6 left, committable6 left, coverable6 left, bloatable6 left, bisectable6 left, evalable6 left, tellable6 left, releasable6 left, shareable6 left, sourceable6 joined, quotable6 joined 01:09 tellable6 joined, squashable6 joined, greppable6 joined, unicodable6 joined 01:10 notable6 joined 01:11 statisfiable6 joined, reportable6 joined, bloatable6 joined, bisectable6 joined 01:13 rir_ joined 01:15 rir_ left 01:45 frost joined
elcaro I can dynamically define a module sub like so `OUR::{"&$name"} := sub { ... }`, but can I define multi sub's? 02:01
02:08 committable6 joined 02:10 nativecallable6 joined, coverable6 joined, releasable6 joined 02:36 frost left 02:49 frost joined 03:08 discord-raku-bot left, discord-raku-bot joined 03:10 benchable6 joined 03:41 frost left 04:09 frost joined 04:11 shareable6 joined 04:18 frost left 04:42 mtj left 04:43 mtj joined 04:56 euandreh left 05:56 greppable6 left, coverable6 left, notable6 left, nativecallable6 left, statisfiable6 left, quotable6 left, sourceable6 left, bloatable6 left, squashable6 left, bisectable6 left, reportable6 left, tellable6 left, unicodable6 left, releasable6 left, committable6 left, benchable6 left, shareable6 left 05:57 shareable6 joined, reportable6 joined, bloatable6 joined, coverable6 joined 05:59 benchable6 joined, nativecallable6 joined, sourceable6 joined, quotable6 joined 06:07 reportable6 left 06:09 reportable6 joined
samebchase Hi, I need some assistance with Red. I've described the problem here: github.com/FCO/Red/issues/543 06:23
moon-child SmokeMachine: 06:24
06:33 razetime joined, razetime left 06:57 committable6 joined 06:58 squashable6 joined, releasable6 joined 06:59 greppable6 joined, tellable6 joined 07:09 linkable6 joined 07:11 jjido joined 07:33 razetime joined 07:41 abraxxa joined, abraxxa left 07:42 abraxxa joined 07:46 abraxxa left 07:47 abraxxa joined 07:58 statisfiable6 joined 08:05 jjido left 08:11 evalable6 joined, jjido joined 08:14 frost joined 08:15 razetime left 08:19 frost left, moon-child left, moon-child joined 08:25 frost joined 08:34 Sgeo_ left 08:56 hasrthur joined 08:59 bisectable6 joined 09:34 lichtkind_ joined 09:43 jjido left 09:56 notable6 joined 10:05 linkable6 left 10:17 Oshawott joined, razetime joined 10:18 archenoth left 10:58 linkable6 joined 10:59 unicodable6 joined
tbrowder wish i could help, but i have my own problems this morning :-( 11:14
lizmat wishes tbrowder strength 11:15
tbrowder thnx, i'm getting a weird error about Mu while iterating over an array. 11:16
the algo is like this: while @a.elems { say @a.tail.value // ''; @a.pop} 11:20
at some point i get this error which i will show in a minute (i forgot to note it).... 11:21
"No such method 'value' for invocant of type Mu" 11:22
11:23 jjido joined
tbrowder i think i need to put a test higher up...gotta run. but does anyone know if Larry or Damian will be in Houston? 11:24
lizmat say @a.pop.value // "" while @a.elems 11:47
pop returns the last value... so no need to do a .tail
tbrowder ok, thnx 12:04
12:07 reportable6 left 12:10 razetime left, reportable6 joined 12:20 lichtkind__ joined 12:21 Altai-man joined 12:22 lichtkind_ left 13:13 lichtkind__ left 13:14 lichtkind joined 13:47 abraxxa left 14:03 Altai-man left 14:07 ecocode left 14:08 Altai-man joined 14:12 ecocode joined 14:52 frost left 15:07 ecocode left 15:12 ecocode joined 15:22 frost joined 15:36 Sgeo joined 15:46 euandreh joined 16:00 demostanis[m] left 16:01 Kaipi left, Kaipi joined 16:22 frost left 16:37 wingfold joined 16:47 wingfold_ joined 16:49 wingfold_ left 16:50 wingfold left 16:53 wingfold joined
samebchase Hi, I have a Red model, in which a column is of the Json type, and can be null in some situations. When I fetch the rows, I get the "Use of uninitialized value element of type Any in string context." message printed on the console, seems to be coming from github.com/FCO/Red/blob/master/lib...son.pm6#L5 where from-json is called on 17:03
the Nil value.
What can I do here, to prevent this from being printed. I'm trying various default values, but no luck so far.
lizmat I have no idea, perhaps try the #red channel? 17:04
samebchase wow, didn't know 17:05
joining it
17:07 Skarsnik left, Skarsnik joined
tonyo fez has had more than 40k downloads 17:15
lizmat wow 17:16
17:25 TempIRCLogger left, TempIRCLogger joined
japhb Nice! 17:25
17:26 TempIRCLogger left, TempIRCLogger joined, TempIRCLogger left, TempIRCLogger joined
patrickb tonyo: Is that # of modules downloaded from the fez eco, or # of downloads of fez itself? 17:28
tonyo from the fez eco 17:29
patrickb k
17:41 Altai-man left 17:43 discord-raku-bot left, discord-raku-bot joined 17:45 djerius left 17:47 djerius joined 17:55 djerius left 17:57 djerius joined 18:05 jjido left 18:06 wingfold left, reportable6 left
patrickb c: my %h = a => [1,2]; my @b = %h<a>; dd @b; 18:40
committable6 patrickb, ¦my: «Cannot find this revision (did you mean “nom”?)»
patrickb m: my %h = a => [1,2]; my @b = %h<a>; dd @b;
camelia Array @b = [[1, 2],]
patrickb How is this mechanic called? (Arrays coming out of hashes need to be slipped to be iterated or assigned.) 18:42
Is that documented? I've been unable to find any hint about this in the docs. 18:43
ugexe its the same as my @a = $[1,2]; my @b = @a; 18:47
dunno about the vernacular though 18:49
patrickb m: my @a = 1, 2; my %h = a => @a; my @b = %h<a>; dd @b; 18:50
camelia Array @b = [[1, 2],]
patrickb I'm unsure which bit of information I need to remember to not be confused the next time I want to iterate a list I've pulled out of a Hash. 18:53
tonyo i just think of it as `my @x = ` always surrounds its args with [].. 18:55
m: my @a = 1,2,3; dd @a;
camelia Array @a = [1, 2, 3]
patrickb m: my @a = 1,2; my %h = :@a; say $_ for %h<a>;
camelia [1 2]
patrickb my @a = 1,2; say $_ for @a;
evalable6 1
2
lizmat the list in the hash is itemized, and that's why it won't iterate 18:56
m: my %h = a => [1,2]; my @b = %h<a><>; dd @b
camelia Array @b = [1, 2]
lizmat m: my %h = a => [1,2]; my @b = @%h<a>; dd @b 18:57
camelia Array @b = [Failure.new(exception => X::AdHoc.new(payload => "Type List does not support associative indexing."), backtrace => Backtrace.new)]
lizmat m: my %h = a => [1,2]; my @b = @(%h<a>); dd @b
camelia Array @b = [1, 2]
patrickb So the basic rule to remember is that I always have to put a "|" before a hash access if I want to get the list/array out the same as I put it in. 18:58
Is that a good rule to remember? Or is the actual thing to be aware of something else?
patrickb tries to grasp the deeper concept. 18:59
ugexe if you don't care about copying just using binding 19:00
m: my %h = a => [1,2]; my @b := %h<a>; dd @b;
camelia [1, 2]
19:04 thundergnat joined
thundergnat m: sub plural ($x, $n) { $x ~ ($n - 1 ?? 's' !! '') }; say "$_ { plural 'dog', $_ }" for ^3; 19:05
camelia WARNINGS for <tmp>:
0 dogs
1 dog
2 dogs
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<->' (line 1)
thundergnat ?? There's no dead code there. 19:06
bisectable: old=2021.10 new=HEAD sub plural ($x, $n) { $x ~ ($n - 1 ?? 's' !! '') }; say "$_ { plural 'dog', $_ }" for ^3;
bisectable6 thundergnat, Bisecting by output (old=2021.10 new=7dc3add) because on both starting points the exit code is 0
thundergnat, bisect log: gist.github.com/344e42bec8bed2259d...8852b29973
thundergnat, (2021-12-16) github.com/rakudo/rakudo/commit/71...7d13855ce1
ugexe well it did qualify it with "potential"
patrickb ugexe, tonyo, lizmat: Thanks for your explanations and examples. Let's see how long I'll remember this. 19:07
thundergnat Hmm. I think that code needs a little more tweaking.
lizmat hmmm... I wonder if it would make sense to make a SlippyHash module, that would automatically turn any List into a Slip, and every hash into a Slip of Pairs 19:08
tonyo thundergnat: it looks ilke that's being interpreted as `sub plural ($x, $n) { $x ~ ($n - (1 ?? 's' !! '')) }`
thundergnat It now warns for anything that treats an integer like a boolean.
lizmat thundergnat: how about $x ~ ('s' if $n != 1)
tonyo but it's working correctly ^
19:09 reportable6 joined
thundergnat m: say 3 % 1 ?? 'odd' !! 'even' 19:09
camelia WARNINGS for <tmp>:
even
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<%>' (line 1)
lizmat mL sub m($x,$n = 1) { $x ~ ('s' if $n != 1) }; say m dog
thundergnat That broke about 15 - 20 scripts I have out in the wild.
lizmat m: sub m($x,$n = 1) { $x ~ ('s' if $n != 1) }; say m dog
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
dog used at line 1. Did you mean 'log'?
lizmat m: sub m($x,$n = 1) { $x ~ ('s' if $n != 1) }; say m 'dog'
camelia dog
lizmat m: sub m($x,$n = 1) { $x ~ ('s' if $n != 1) }; say m 'dog',2 19:10
camelia dogs
lizmat m: sub m($x,$n = 1) { $x ~ ('s' if $n != 1) }; say m 'dog',0
camelia dogs
thundergnat The problem is with the bogus warning on ternaries.
m: say 3 % 1 ?? 'odd' !! 'even'
camelia WARNINGS for <tmp>:
even
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<%>' (line 1)
thundergnat There is no dead code there. ^^ 19:11
And that worked without warnings until github.com/rakudo/rakudo/commit/71...7d13855ce1
lizmat m: say # % 1
camelia ===SORRY!===
Argument to "say" seems to be malformed
at <tmp>:1
------> say⏏ # % 1
Other potential difficulties:
Unsupported use of bare "say". In Raku please use: .say if you meant
to call it as a method on $_, or …
lizmat m: say 3 % 1
camelia 0
thundergnat Its the ternary 19:12
lizmat thundergnat: please make an issue for it... so that we can revert before 2022.01
Voldenet m: my $rows = 2; my $columns = 5; my $vertical = True; say(10 % $vertical ?? $columns !! $rows) 19:16
camelia WARNINGS for <tmp>:
2
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<%>' (line 1)
Voldenet there could be uses for this warning
m: say (3 % 1) ?? 'odd' !! 'even' 19:17
camelia even
ugexe code is either dead or its not 19:20
lizmat
.oO( only when you look at it :-)
19:21
Voldenet well, the original case from the commit `"a = " ~ $a ?? "true" !! "false"` is certainly not containing any dead code 19:23
m: class Uh { }; multi infix:<~>(Str $a, Uh $b){ };my $a = Uh.new; say "a = " ~ $a ?? "true" !! "false" 19:26
camelia false
Voldenet m: class Uh { }; multi infix:<~>(Str $a, Uh $b){ }; my $a = "ok"; say "a = " ~ $a ?? "true" !! "false" 19:28
camelia true
Voldenet …i'm quite sure this fix doesn't work as expected
moon-child m: my $a = "ok"; say "a = " ~ ($a ?? "true" !! "false") 19:34
camelia a = true
moon-child it parenthesizes as ("a = " ~ $a) ?? "true" !! "false"
I think master has a warning for that
19:34 tinita_ is now known as tinita
moon-child oh, you know about that. I need to read more than 1 line of scrollback 19:35
sorry
thundergnat m: say 3 %% 2 ?? 'even' !! 'odd' 19:40
camelia odd
thundergnat m: say 3 % 2 ?? 'odd' !! 'even'
camelia WARNINGS for <tmp>:
odd
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<%>' (line 1)
thundergnat It only seems to warn about expressions that aren't explicitly a boolean 19:41
issue filed: github.com/rakudo/rakudo/issues/4719 19:42
MasterDuke yes, that's what this conditional is trying to do github.com/rakudo/rakudo/commit/71...96f32R1523
if anyone has an idea for how to tighten it up i'm all ears 19:43
thundergnat MasterDuke: I'm not against the warning in principle, but it kind of spoils some DWIMery I tend to lean on. See the Issue I filed for links to multiple script in the wild this affects. 19:45
MasterDuke well, it also exposes a *completely* unrelated bug, so it's at least likely to get reverted before the next release 19:47
m: my $v = 3; my $sign = $v +> 31 ?? -1 !! 1; say $sign
camelia (signal SEGV)
MasterDuke happens in the optimizer in the code i added, but the fault lies somewhere else 19:48
Voldenet m: my $a = 2.rand.Int; say "a = " ~ $a ?? "true" !! "false"; 19:49
camelia WARNINGS for <tmp>:
true
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<~>' (line 1)
Voldenet i think it only makes sense to warn in case: Str ~ Str ?? … !! … 19:50
or even Str ~ … ?? … !! … 19:51
MasterDuke it isn't a property of the operands, but the operator 19:52
m: my $a = 2.pick; say 1 ~ $a ?? "odd" !! "even"
camelia WARNINGS for <tmp>:
odd
Potential dead code, the '?? !!' is gobbling up the result of the '&infix:<~>' (line 1)
thundergnat Voldenet: opinions differ. rosettacode.org/wiki/I_before_E_ex...ter_C#Raku <-- This was written by TimToady more than 7 years ago and now warns 19:53
MasterDuke where's the warning (i thought it would be the last line, but it isn't) 19:55
Voldenet If that's the property of the operator then ~ can always warn 19:56
thundergnat MasterDuke: Argh. It is the last line, but the version I was looking at uses string concatenation rather than the comma separated list. So that one isn't in the wild. Red herring. 19:59
20:07 thundergnat left 20:22 discord-raku-bot left, discord-raku-bot joined
Anton Antonov Is the #red channel I have reachable with Discord? 20:24
lizmat gfldex might know 20:28
Anton Antonov @lizmat Thanks! 20:32
21:11 xinming joined 21:22 euandreh left 21:42 hasrthur left 22:00 notna joined 22:03 Tirifto left 22:10 euandreh joined 22:21 jjido joined
Geth doc: codesections++ created pull request #4015:
Expand qq docs re esc sequences
22:42
22:43 Xliff left 23:01 jjido left 23:21 notna left 23:38 djerius left 23:39 djerius joined 23:43 hasrthur joined 23:49 hasrthur left