🦋 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.
Geth ecosystem/main: a827606742 | (Elizabeth Mattijsen)++ | META.list
Remove samcv's modules, they are being moved to zef
11:45
botato timo: thanks, looks like it's already fixed! the moarvm error is LTA but looks like there's already an open issue to improve that too 13:42
librasteve 🍬 13:50
c.a53 @ab5tract I've just installed Comma v2.0-beta.27 and the multi-line REPL seems to work indeed. Thanks for the fix :). 14:05
timo you were wondering if raku's "start" is like green threads or not; we do have "await" that puts an item back into the thread pool's queue of work, but we also have both sync and async IO and it looks like HTTP::UserAgent uses sync IO so it will actually block real threads, and the thread pool scheduler will create quite a few real OS threads; you can turn on RAKUDO_SCHEDULER_DEBUG in the environment 14:07
to see what it's thinking, and optionally RAKUDO_SCHEDULER_DEBUG_STATUS for a lot more messages
we also offer the Thread class which lets you make a full OS thread for lower-level needs, and you can create multiple ThreadPoolScheduler instances with different min and max threads variables, plus CurrentThreadScheduler exists for very specific use cases, and making a custom Scheduler is also possible 14:11
botato thanks, are those debugging environment variables documented? searching I find it in some irc logs and blog posts but no official documentation 14:28
it looks like there's good facilities for debugging threaded code, the moarvm debugger supports listing all threads, threads are named, you can view their stacktraces etc 14:29
timo it's quite possible that there's no official documentation for these vars. all i could find is the changelog mentioning the _STATUS one 14:30
the Comma IDE plugin has support for the debugger as well. the CLI debugger is not very ergonomic, but lizmat and me just a few weeks ago started looking at those pieces again, and patrickb is also working towards a new TUI debugger 14:33
there's some bits and pieces for using GDB with a process that has moarvm in it, but it's all kind of spread out and undocumented, so you really have to already know what exists and how to use it 14:34
like the MVM_dump_backtrace, MVM_dump_bytecode, MVM_dump_p6opaque functions you can invoke with gdb's "print" or "call" commands 14:35
botato for async IO like async networking with Cro are there facilities for debugging it? now everything is in promises and I don't find a way to list all pending promises, get backtraces, etc? ie ruby Async::Debug will list all fibers, their stacktraces, you can open a repl in local context of some fiber. I think I remember reading raku/perl6 has green threads, but it seems that's not the case? ie there is 14:37
thread pool of system threads, and async stuff is based on promises, not green/lightweight threads with their own stack? though I think both is more or less equivalent, ie bluebird promises library for javascript has debug option of longStackTraces that adds extra info to promises to give stacktraces
timo when you "await", we take a continuation, so our tasks ("green threads") do have their own stacks 14:47
there is currently nothing built in to the App::MoarVM::Debugger that gives you a list of all the tasks that exist in a given scheduler for example. you'd have to manually dig through the objects, and that's no fun, of course 14:49
I definitely want that to exist, though
did you see Log::Timeline? github.com/jnthn/raku-log-timeline 14:52
the only viewer i know of is in Comma
but it does specifically point out that it shows the start and end times of "start" blocks as well as await statements, and stuff 14:53
but logging and realtime display of a timeline is not the same thing as a debugger
github.com/jnthn/raku-log-timeline...#L179-L211 that isn't terribly complicated 14:59
librasteve o/ 15:19
okaaay - I have been jealous of the Fragments feature in other web template engines - as described here htmx.org/essays/template-fragments/ 15:44
sooo - I went and made this feature in cro-webapp and have just submitted a PR there and at cro-website for the docs 15:45
hopefully there is general support for this as a new Cro feature and if it is accepted it will show that Cro (like Comma) is definitely not a dead parrot 15:47
(questions / feedback welcome!)
timo ah, that's neat 15:57
botato interesting, thanks 16:09
timo so where would a good place be to put documentation about the various environment variables that can influence rakudo and moarvm behaviour? 16:15
timo github.com/rakudo/rakudo/wiki/dev-...ars#moarvm this is linked from rakudo/docs/running.pod 16:16
timo i guess that already has a good portion of all the env vars documented 16:22
not the github wiki page, i mean the running.pod document
github.com/rakudo/rakudo/blob/main...unning.pod
but that's kind of out-of-the-way still. it should perhaps be migrated or at least copied over to docs.raku.org, even though it's about rakudo and not necessarily about raku
docs.raku.org/programs/03-environment-variables
xinming m: class T { {my $set = <a b c>.Set; has $.t where * (elem) $set = "a" }; submethod BUILD (:$!t) { $!t.say; }; }; T.new(:t<x>) 16:37
camelia ===SORRY!=== Error while compiling <tmp>
Can never assign default value Str ("a") to attribute '$!t', it expects: <anon>
at <tmp>:1
xinming m: class T { { has $.t where * (elem) <a b c> = "a" }; submethod BUILD (:$!t) { $!t.say; }; }; T.new(:t<x>)
camelia Type check failed in assignment to $!t; expected <anon> but got Str ("x")
in submethod BUILD at <tmp> line 1
in block <unit> at <tmp> line 1
xinming m: class T { { has $.t where * (elem) <a b c> = "a" }; submethod BUILD (:$!t) { $!t.say; }; }; T.new(:t<a>)
camelia a
xinming m: class T { {my $set = <a b c>.Set; has $.t where * (elem) $set = "a" }; submethod BUILD (:$!t) { $!t.say; }; }; T.new(:t<a>)
camelia ===SORRY!=== Error while compiling <tmp>
Can never assign default value Str ("a") to attribute '$!t', it expects: <anon>
at <tmp>:1
xinming m: my $set = <a b c>.Set; ("a" (elem) $set).raku.say; 16:38
camelia Bool::True
xinming Is this a bug in where ?
m: class T { {my $set = <a b c>.Set; has $.t where { $_ (elem) $set } = "a" }; submethod BUILD (:$!t) { $!t.say; }; }; T.new(:t<x>) 16:40
camelia ===SORRY!=== Error while compiling <tmp>
Can never assign default value Str ("a") to attribute '$!t', it expects: <anon>
at <tmp>:1
xinming m: class T { {my $set = <a b c>.Set; has $.t where { $_ (elem) $set } = "a" }; submethod BUILD (:$!t) { $!t.say; }; }; T.new(:t<a>)
camelia ===SORRY!=== Error while compiling <tmp>
Can never assign default value Str ("a") to attribute '$!t', it expects: <anon>
at <tmp>:1
xinming hmm, The 'where * (elem) $set' 'where { $_ (elem) $set)' Neither worked. 16:41
timo i don't think you can do that with a { my ... } because it's not compile-time-known? 16:49
m: class T { {my $set = <a b c>.Set; has $.t where { say "evaluating $_ against $set.raku()"; $_ (elem) $set } = "a" }; };
camelia evaluating a against Any
===SORRY!=== Error while compiling <tmp>
Can never assign default value Str ("a") to attribute '$!t', it expects: <anon>
at <tmp>:1
16:50
timo m: class T { BEGIN { my $set = <a b c>.Set; has $.t where { say "evaluating $_ against $set.raku()"; $_ (elem) $set } = "a" }; };
camelia evaluating a against Set.new("a","c","b")
timo so not a bug in "where" per se
somewhere between an LTA, a footgun, and something we should be able to fix? 16:51
also, would be good to have the error show something better than "<anon>". even if it's only like "expected to match against unnamed subset / condition" or whatever 16:52
timo also, probably a good idea to make it clear / known / documented that this is a way for compile-time code execution to happen? we don't really document that kind of thing thoroughly at the moment i don't think? 16:52
xinming timo: Thanks, I forgot about the compile-time vs runtime thing. 17:10
timo: I think there is a bug 17:16
timo: termbin.com/wl2i This is the sample which works with 'where { }', But doesn't work with 'where * ...' 17:18
Also, Move the 'my %calculator' out of the BEGIN block will also trigger same errors with 'has $.t ...' line 17:19
neither 'has $.t where * ...' nor 'has $.t where { }' works. 17:21
guifa I wonder if the whatever there is for some reason clobbering the default 17:25
but no that would give an error of assigning 'min' to True
ugexe xinming: in your example should :method be :t?
xinming ugexe: Yea 17:27
timo all this will be extra fun because the error probably won't show up if you --optimize=off or --optimize=0 18:12
timo you're right, with the { } the argument passed to (elem) is the right set, but with the WhateverCode it's "Any", even though outputting $set a line above it (still in the BEGIN block) gives the expected output 18:16
funny enough, if you use `where $set` it works fine 18:17
since the default smartmatch on Set is element check 18:18
it side-steps the bug, but i've not looked at how we could fix that issue. assuming it is an actual bug. i think it is a bug
xinming So, this is a optimization bug related with whatever code convertion. 18:22
timo well, the optimizer being involved here is mostly because that's the stage where we do this kind of check, at least it is for some similar checks, like `sub a(Str $a) { }; a(6)` is caught by the optimizer 18:25
cool, i was wrong, this happens immediately in stage parse apparently 18:36
wait, no, it's in a begin block, so stagestats doesn't tell the whole story
create_BUILDPLAN is the spot where the check happens and fails for the * (elem) $set case 18:37
the optimizer is actually not involved in this 18:38
SmokeMachine is there a way to force RAKUDO_RAKUAST=1 with out setting the envvar? from inside the scipt? I think there is a `use` to that, am I right? 19:13
guifa I don't think so 19:15
timo there is the "use experimental :rakuast" but that doesn't cause your program to be parsed by the rakuast parser i don't think
that use only gives you the AST method and rakuast classes i imagine
what's your use case? 19:16
SmokeMachine I think `use experimental :rakuast` only gives you access to the RakuAST classes... :? 19:17
:)
:( that's what I meant... 19:18
my problem it that I'm writing a test that needs RAKUDO_RAKUAST=1...
timo then i would say put the source code of the test in a huge heredoc string and "run" it? 19:19
librasteve err $*ENV<RAKUDO_RAKUAST> = 1 maybe
timo probably easier to get the rakuast compiler, feed the source in, compile it, and run the result
librasteve, even if you put that in BEGIN, it's probably too late to actually switch into rakuast mode 19:20
librasteve oh
SmokeMachine maybe I'll need to not test that as it should be used, but using Str.AST... :( 19:21
this was my test: usercontent.irccloud-cdn.com/file/.../image.png 19:22
guifa SmokeMachine: or just fail if it's not with RAKUDO_RAKUAST ? 19:27
SmokeMachine but it would always fail, no? 19:28
timo maybe skip instead of fail, but without a way to get the test run with rakuast turned on, for example by `zef test`, how would the test be useful? 19:29
also, in the future, rakuast will be the default parser even without RAKUDO_RAKUAST
SmokeMachine I think I'm going with this: usercontent.irccloud-cdn.com/file/.../image.png 19:30
librasteve &afk 19:33
SmokeMachine I released 2 modules but I can't install them... 21:09
usercontent.irccloud-cdn.com/file/.../image.png
usercontent.irccloud-cdn.com/file/.../image.png 21:10
raku.land/?q=ASTQuery and raku.land/?q=Acme::Overreact 21:11
[Coke] what are the git repos? 21:38
(and when did you upload?)
Looks like Acme::Overreact is in the ecosystem, but not ASTQuery, but since it depends on that.. 21:39
What's the git repo for ASTQuery?
[Coke] finds github.com/FCO/ASTQuery. 21:47
git
installs fine from git repo, fwiw. 21:48
don't see any obvious errors in the META6.json 21:49
SmokeMachine ASTQuery was released last week and a new version today just before I released the other one… 21:56
[Coke]: 👆 21:57
[Coke] ok. ASTQuery isn't on 360.zef.pm - so let's ping tonyo, I guess? 22:14
or coleman - any idea on how to diagnose why something that a user uploaded with fez isn't available? 22:20
guifa [Coke] that's a good tonyo question 22:22
coleman ask tonyo, because I dunno, but whenever we figure out the answer I'd be interested 22:32
[Coke] SmokeMachine: maybe open a ticket here: github.com/tony-o/raku-fez ? 22:41
SmokeMachine Yeah, thanks! I’ll do that! 22:43
[Coke]: github.com/tony-o/raku-fez/issues/121 23:02