🦋 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.
01:08 hulk joined, kylese left 02:15 hulk left, kylese joined 03:45 kylese left 03:49 kylese joined 04:09 guifa left 04:47 maylay left 04:49 maylay joined 05:07 Aedil joined 05:20 jmcgnh left 05:22 jmcgnh joined 05:23 sivoais left, sivoais joined 05:30 lizmat_ joined 05:31 andinus left 05:32 andinus joined 05:33 lizmat left 05:47 human-blip left 05:49 human-blip joined 06:37 stanrifkin joined 07:12 Sgeo left 07:22 lichtkind joined 07:36 Guest85 joined 07:56 wayland76 joined 08:01 dakkar joined 08:02 apac joined 08:37 stanrifkin left 08:49 donaldh left
librasteve wayland76: this is pretty much what Cromponent (smoke machine is author) does for HTML components … you may want to look at his pattern 09:02
09:04 Altreus left, Altreus joined
although he is making cro routes as opposed to exposing command verbs of course 09:07
09:11 Guest85 left 09:26 stanrifkin joined 09:59 sjm_ left, sjm_ joined 10:03 sjm__ joined 10:04 sjm_ left 10:10 lizmat_ left, lizmat joined 10:27 apac left 10:54 donaldh joined 12:05 guifa joined 12:45 apac joined
[Coke] m: say 180/450 14:04
camelia 0.4
14:04 jgaz joined
librasteve crag 180/450 use crag and save time typing out "say" (thanks to lizmat) 14:41
[Coke] installed crag: 14:48
crag 3+2 3.69s user 0.08s system 109% cpu 3.454 total
the runtime is consistent, it's not a one time cost. 14:50
ugh. using chrome on github.com, search for º in a page... matches plan o's also. 14:54
lizmat uh oh :-)
[Coke] :plain 14:57
I can almost see doing it the other way, but if I've gone to the trouble to type the more specific character... 15:00
Voldenet m: sub a { die }; sub b { CATCH { default { .say }}; a }; sub MAIN { b } 15:06
camelia Died
in sub a at <tmp> line 1
in sub b at <tmp> line 1
in sub MAIN at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet hm, it is a bit odd that catch prints full stack trace 15:07
is there a way to say "print stack trace only relative to current method" 15:08
so I'd get `Died␤ in sub a at <tmp> line 1␤ in sub b at <tmp> line 1␤ ␤ `
I'm spoiled by C# that does this by default dotnetfiddle.net/m4I4D8 15:12
lizmat --ll-exception ? 15:13
[Coke] I would expect ll to show you *more*, not *less* 15:14
Voldenet (more specifically .net, I'm not sure if C# defines this specfic behavior) 15:15
still, I've checked, the following isn't specifically shorter `raku --ll-exception -e 'sub a { die }; sub b { CATCH { default { .say }}; a }; sub MAIN { b }'` 15:16
hmmm, there is one way, it's a bit silly 15:18
m: sub a { die }; sub b { CATCH { default { .say }}; a }; sub MAIN { await start b }
camelia Died
in sub a at <tmp> line 1
in sub b at <tmp> line 1
in code at <tmp> line 1
15:19
lizmat Voldenet: you could try playing with: CATCH { default { say .backtrace[1] } } 15:21
coranila m: sub f { die }; try f; say $!.payload[0] 15:32
evalable6 Died
Raku eval Died
coranila from there i guess you could guess how far you wanna go by looking for GLOBALish in CALLER:: recursively? 15:33
15:34 apac left
but yeah backtrace gives you CX as well, mine only gives you X, as far as i can tell 15:34
Voldenet lizmat: yes, this approach sort of works, but it feels a bit ugly 16:06
m: sub a { die }; sub u { a }; sub b { my $rel = Backtrace.new.elems; CATCH { default { .backtrace[0 .. * - $rel].grep(!*.is-setting).join().say }}; u }; sub MAIN { b } # this kind of works 16:07
camelia in sub a at <tmp> line 1
in sub u at <tmp> line 1
Voldenet btw 16:11
m: sub a { die }; sub u { a }; sub b { my $rel = Backtrace.new.elems; CATCH { default { my List:D $l = .backtrace[0 .. * - $rel]; Backtrace.new($l).Str.say }}; u }; sub MAIN { b } # non-working example
camelia
Voldenet I thought Backtrace.new would accept List:D, so why is the result empty?
coranila m: sub f { die "blerg" }; sub g { f }; sub h { g }; try h; .say for $!.backtrace.>>.subname 16:27
evalable6 throw
die
f
g
h

<unit>
Raku eval throw die f g h <unit>
16:40 dakkar left 17:20 Guest56 joined 17:21 Guest56 left
librasteve [Coke] yep … crag is slow as a dog … hoping that macros or AST for hotspots will speed that up 17:42
lizmat haz a look at App::Crag again 17:47
[Coke] probably want to upgrade your source URL to git@ instead of git:// in App::Crag 17:53
I imagine the EVAL doesn't help? 17:56
lizmat librasteve it's more that the EVAL contains &infix:<> statements, which change the grammar 17:57
19:30 dmvrtx joined
librasteve thanks for the advice! tbh crag was a quick and dirty app layer over many modules - so you can do fun things like … 19:38
crag '$s=Speed.new(value=>0rXL,units=>"mph"); $d=Distance.new(value=>0rMM,units=>"ft"); say "lap-time {$d/$s}"' 19:39
it imports 5 modules and the slow start is predominately Physics::Measure / Physics::Unit 19:40
it was also a pathfinder to how best to write measurements with a value and some units in code with a view to recasting as a slang … and i have some ideas in that direction 19:42
19:48 apac joined
so, yes these modules need some performance tuning love … and my long term plan is to come back and sprinkle the AST magic … tbh macros are really the answer since we wanna premake about 227 unit objects to go fast (feet, inches, meters and so on) and that takes 13sec last time i rewrote the code - that’s because I use the same Unit Grammar to parse my premakes … guess i could rewrite as a core grammar (or 19:49
sidestep grammar for the core) and an extended grammar but yada yada … so the current 4th iteration is decidedly lazy so all the pain is happening at runtime
20:16 Aedil left
wayland76 .tell librasteve I actually already have most of the code, I just have one part that I'd like to do in Tree-Oriented Programming. I won't need the whole Tree-Oriented Programming thing, just the first part (the XPath-like part), but that's about the 4th thing on my list at the moment. 20:54
tellable6 wayland76, I'll pass your message to librasteve
[Coke] Just moving 90% of the EVAL code out so it gets compiled speeds up 'crag 2+3' to 1.24s on my box. 21:02
gist.github.com/coke/dc185e3696604...fcf7035e44 21:03
m: say 1.24/3.69 21:04
camelia 0.336043
[Coke] so, runs in 1/3 of the time.
21:28 guifa left 21:34 stanrifkin left
wayland76 If I've made a small contribution to the tests for rakudo, what do I do to build/test them before I make a PR? I was hoping github actions would take care of it for me, but it looks like it doesn't. 21:47
Voldenet I think PRs will get automatically tested after being requested 21:51
22:02 guifa joined 22:03 guifa left 22:07 lichtkind left 22:24 Sgeo joined
wayland76 OK, thanks! :) 22:24
22:49 apac left 23:14 wayland76 left
coranila wayland76: make test or make spectest, depending on whether it's a Rakudo test or a Raku test 23:20
tellable6 coranila, I'll pass your message to wayland76
coranila wayland76: alternatively make $repative_file_path runs only one test file
tellable6 coranila, I'll pass your message to wayland76 23:21
coranila typo...
23:42 vasko left 23:51 vasko joined