🦋 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.
kybr do we have -Werror ? my program is throwing a warning and i cant catch it 02:40
MasterDuke try `use fatal` 02:54
or try catching with `CONTROL { ... }` instead of `CATCH { ... }` 02:55
lucs Let's say I'm printing out the elements of an array holding arbitrary values. 03:19
If an element is undefined, how would you suggest I represent it: 'Nil', 'Any', 'undef', something else?
Xliff m: my $c = 0; start { $c++ }; $*SCHEDULER.cue( every => 2, -> *@a { $c.say }); sleep 10 05:13
camelia 1
1
1
1
1
Xliff \o 09:11
I know this might be the wrong channel, but could someone explain what this means: "dataLabels?: CommonDataLabelBoxTheme &"
When used in this context: github.com/nhn/tui.chart/blob/main...art-pie.md
I'm trying to write Raku wrappers for it.
guifa_ My guess is it's a very odd choice for an OR equivalent 10:03
holmdunc its type is a new type that's the merger of the named type CommonDataLabelBoxTheme and the anonymous/structural type that follows the ampersand. It can also have the value undefined thanks to the question mark
Voldenet Xliff: it's an optional field of intersection type obviously 11:47
Voldenet in raku it would be: class CommonDataLabelBoxTheme { has Bool $.useSeriesColor; … }; class DataLabels is CommonDataLabelBoxTheme { has CommonDataLabelBoxTheme $.pieSeriesName; … }; 11:51
and `has DataLabels $.dataLabels` 11:52
Xliff `Voldenet: Thanks. That's what I ended up going with. S 14:06
Voldenet btw, funny that type intersection has all the fields, but type union has only intersection of fields… :D 14:07
Xliff Yes, and the syntax is horrible! 14:12
Voldenet m: my $x = 42; given $x { when Int { say "nope" }; default { say "obviously" }} 16:33
camelia nope
Voldenet m: my $x = 42; given $x -> $y { when Int { say "nope" }; default { say "obviously" }}
camelia obviously
Voldenet I'm left with puzzled face 16:34
m: my $x = 42; given my $y = $x { when Int { say "nope" }; default { say "obviously" }} 16:36
camelia nope
Nemokosch m: my $x = 42; given $x { .&dd }; given $x -> $y { .&dd }; given my $y = $x { .&dd } 16:38
Raku eval Int $x = 42 Any $_ = Any Int $y = 42
Nemokosch it's not that surprising tbh, if you think that the block of given is indeed a Raku block 16:39
if you specify the parameter to be $y, why would it be passed as $_?
Voldenet Well yes, obviously :) 16:40
RaycatWhoDat Does anything prevent MoarVM from being ported to WASM? 17:08
I would imagine it would be pretty slow 17:09
[Coke] I would imagine rather than porting moarvm, you might want a WASM backend to NQP 17:29
Someone asked recently about maybe a nativecall-esque interface to wasm in moarvm also 17:33
patrickb In general the performance of software written in C and compiled to WASM is not as bad as one might think. It's an approach multiple 3D game engines (unity, unreal) have taken. They perform acceptably fast.
tonyo interesting 17:41
drudge Hello all! Have a quick question on phasers, as mine aren't doing what I expect. Do `repeat while` statements support the LAST phaser? I can't find precedent for my issue 18:53
it appears my LAST block is executing in tandem with FIRST when inside a `repeat while` block combination
hastebin.com/share/ivepiromoy.perl I'm simply printing every three numbers in a range and adding "+" x 10 18:54
I should've read the sticky first, this is likely more appropriate for #raku-beginner 18:55
I'm on Rakudo v2023.04
Voldenet m: my $iter = 12;repeat {FIRST say "+" x 10;FIRST {say "$iter"};say "{$iter += 3}";LAST say "+" x 10;} while $iter < 75; 19:00
camelia ++++++++++
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
++++++++++
Voldenet …works for me?
if your output isn't the same, then it sounds like some kind of bug 19:01
m: sub foo { my $iter = 12;repeat {FIRST say "+" x 10;FIRST {say "$iter"};say "{$iter += 3}";LAST say "+" x 10;} while $iter < 75; }; foo 19:03
camelia ++++++++++
++++++++++
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
Voldenet m: sub foo { my $i = 1; repeat { say $i; LAST say "end"; } while $i++ < 5 ; }; foo 19:05
camelia end
No such method '!capture_phasers' for invocant of type 'Code'
in block <unit> at <tmp> line 1
Voldenet sub foo { while False { LAST say "foo" } }; foo 19:07
evalable6 foo
Voldenet sub foo { repeat { LAST say "foo" } while False }; foo
m: sub foo { repeat { LAST say "foo" } while False }; foo 19:08
camelia foo
No such method '!capture_phasers' for invocant of type 'Code'
in block <unit> at <tmp> line 1
[Coke] I have pressed the button to change master to main on MoarVM/MoarVM 19:13
drudge when i write it one liner like you provided it works e.g. my $iter = 12;repeat {FIRST say "+" x 10;FIRST {say "$iter"};say "{$iter += 3}";LAST say "+" x 10;} while $iter < 75;
[Coke] might need to update rakubrew
drudge I'm using `rakudo-pkg` on Ubuntu 19:14
ok, when I take it out of the MAIN subroutine it works 19:16
literally just deleted sub MAIN () {}
I'm calling it via `raku path/to/file`
weird, I'll assume this is a bug rather than me not knowing what I'm doing this time :P 19:17
thank you much for your help 19:21
[Coke] try wrapping it just a {} instead of a sub MAIN() { } - I suspect the phasers are triggering when in either block vs. no block? 19:38
drudge wrapping in {} works 19:40
adding main again breaks it
[Coke] can you gist it? 19:45
want to see if it fails the same way here. 19:46
drudge m: sub MAIN () {my $iter = 12;repeat {FIRST say "+" x 10;FIRST {say "$iter"};say "{$iter += 3}";LAST say "+" x 10;} while $iter < 75;} 19:49
camelia ++++++++++
++++++++++
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
drudge hopefully that's what you mean by gist it 19:50
{my $iter = 12;repeat {FIRST say "+" x 10;FIRST {say "$iter"};say "{$iter += 3}";LAST say "+" x 10;} while $iter < 75;}
evalable6 ++++++++++
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
++++++++++
gfldex drudge: this is where gists go: gist.github.com/ 20:04
there are CLI tool too ofc 20:05
Voldenet m: sub foo { for 1 { repeat { LAST say "foo" } while False } }; foo 20:22
camelia foo
Voldenet the workaround is fairly easy, but ugly 20:23
tonyo m: state $i = 0; repeat { $i++; say $i; LAST { say "last"; }; } while $i < 12; 20:38
camelia 1
2
3
4
5
6
7
8
9
10
11
12
last
leont What's the right JSON implementation to use nowadays? JSON::Fast? 20:53
Nemokosch yes, pretty much
most maintained at least
gfldex lolibloggedalittle: gfldex.wordpress.com/2023/05/10/co...-coercion/ 21:35
also, my head hurts a little :)
tonyo gfldex: is the COERCE what you ended up with for the .T ? 21:37
gfldex aye
tonyo pretty cool