🦋 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.
00:00 reportable6 left 00:01 reportable6 joined 00:17 simcop2387 left 00:18 simcop2387 joined 00:53 gcd left, Guest8096 is now known as Sauvin 01:03 xinming left 01:05 xinming joined 01:06 gcd joined 01:25 razetime left 01:26 japhb left 01:30 razetime joined 01:31 japhb joined 01:36 japhb left 01:48 japhb joined 02:28 Sgeo left 02:46 ProperNoun joined 02:55 theesm left 03:02 Sgeo joined 03:03 razetime left, swaggboi left 03:14 swaggboi joined 03:47 razetime joined 04:04 swaggboi left 04:17 theesm joined 04:25 swaggboi joined 04:39 razetime left 05:39 shareable6 left, statisfiable6 left, benchable6 left, squashable6 left, reportable6 left, nativecallable6 left, sourceable6 left, unicodable6 left, committable6 left, tellable6 left, bloatable6 left, evalable6 left, bisectable6 left, greppable6 left, quotable6 left, releasable6 left, coverable6 left, notable6 left, linkable6 left, evalable6 joined, initrd joined 05:40 benchable6 joined, tellable6 joined, squashable6 joined, shareable6 joined, sourceable6 joined, greppable6 joined, committable6 joined 05:41 bloatable6 joined, quotable6 joined, coverable6 joined, unicodable6 joined, reportable6 joined, linkable6 joined 05:42 statisfiable6 joined, nativecallable6 joined, releasable6 joined, notable6 joined, bisectable6 joined 05:57 swaggboi left 06:00 reportable6 left 06:03 reportable6 joined, japhb left 06:04 japhb joined 06:10 swaggboi joined 06:43 japhb left 06:44 japhb left, Sgeo left, japhb joined 06:49 teatwo joined 06:51 Sgeo joined 06:53 Sgeo left, tea3po left 06:55 Sgeo joined 06:59 Sgeo left 07:03 Sgeo joined 07:19 jpn joined, swaggboi left 07:20 jpn left 07:32 swaggboi joined 07:39 jpn joined 08:00 razetime joined 08:10 jpn left 08:18 razetime left 08:48 razetime joined 09:19 initrd left 09:39 razetime left 09:40 Sgeo left 10:40 linkable6 left, evalable6 left, evalable6 joined 10:43 linkable6 joined 10:57 codesections left, codesections joined 11:04 Xliff joined
Xliff \o 11:04
Is there a way to get a list of loaded packages (ie 'use'-d) in Raku? 11:05
11:14 jpn joined 11:15 jpn joined
lizmat I think each repo responsible for loading a module, keeps an internal list 11:17
I think each repo responsible for loading a module, keeps an internal list 11:18
that may or not be exposed, not sure
11:22 jpn left 11:33 jpn joined 11:39 jpn left
Xliff FWIW, I was able to shoehorn MY.WHO to do what I needed. 11:58
12:00 reportable6 left
Xliff lizmat: gist.github.com/Xliff/d846eb39d472...a02d7e4357 12:01
12:03 reportable6 joined 12:36 Guest10 joined 12:37 Guest10 left, Guest10 joined, Guest10 is now known as XliffMac
XliffMac Anyone know why I would be getting this error when installing Inline::Perl5 on a Mac Mini? 12:42
ld: warning: ignoring file /opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE/libperl.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 12:43
Nemokosch "announcement" to everybody: please do not use .elems for testing for an empty Positional, it's not sufficient 12:46
XliffMac Also getting this... Cannot assign to an immutable value
in sub install at configure.pl6 line 50
Nemokosch a Positional can be lazy or infinite even, you don't want these to fall back to empty implicitly 12:47
XliffMac Nemokosch: How so? I use the shorthand +@
tellable6 XliffMac, I'll pass your message to Nemokosch
Nemokosch well, there is your answer I think
XliffMac Well, things seem to work. I'd like to know what your thoughts are in case things are quietly failing. 12:48
Nemokosch if you want to know whether it is empty or not, always use the bool check, or at least make sure the data passed can never be a lazy structure
XliffMac So you suggest @.so, instead?
Nemokosch yes
XliffMac Noted! Thanks!
Nemokosch which a bare if implies in itself
the bool check only tries to fetch one single value 12:49
XliffMac Heh. What if that value is 0?
m: my @a = (0); @a.so.say
camelia True
Nemokosch it doesn't care for the value, only its presence
XliffMac Excellent!
m: my @a; @a.push: Nil; @a.so.say 12:50
camelia True
Nemokosch m: my @foo = lazy 1, 2, 3; unless @foo.elems { say 'Yeah, it's empty.' }
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Two terms in a row at /home/glot/main.raku:1 ------> 2, 3; unless @foo.elems { say 'Yeah, it'⏏s empty.' } expecting any of: infix infix stopper postfix statement end statement modifier statement modifier loop
Nemokosch m: my @foo = lazy (1, 2, 3); unless @foo.elems { say 'Yeah, it's empty.' }
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Two terms in a row at /home/glot/main.raku:1 ------> , 3); unless @foo.elems { say 'Yeah, it'⏏s empty.' } expecting any of: infix infix stopper postfix statement end statement modifier statement modifier loop
Nemokosch why
XliffMac Your contraction. 12:51
Use double quotes or q/qq
Nemokosch oof you're right
I looked at the wrong arrow...
m: my @foo = lazy 1, 2, 3; unless @foo.elems { say '"eah, it's empty." }
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Two terms in a row at /home/glot/main.raku:1 ------> 2, 3; unless @foo.elems { say '"eah, it'⏏s empty." } expecting any of: infix infix stopper postfix statement end statement modifier statement modifier loop
XliffMac m: mu @foo = lazy (1, 2, 3); unless @foo.elems { say q<<Yeah, it's empty>>} 12:52
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@foo' is not declared. Perhaps you forgot a 'sub' if this
was intended to be part of a signature?
at <tmp>:1
------> mu ⏏@foo = lazy (1, 2, 3); unless @foo.elems
Nemokosch okay, this is a nonsense
the bot itself sucks I guess
XliffMac m: my @foo = lazy (1, 2, 3); unless @foo.elems { say q<<Yeah, it's empty>>}
camelia Yeah, it's empty
XliffMac Hmmm... does Mac have a working Compose infrastructure somewhere?
Nemokosch dang, thank you
anyways, this is what I wanted to bring up. .elems is a Failure, and if you use it in bool context, it will collapse into False 12:53
lizmat if you're using an array in a conditional, you don't need to .so it, the conditional will do that for you 12:56
m: my @foo = lazy (1, 2, 3); say "something there" if @foo 12:57
camelia something there
lizmat m: my @foo = lazy (1, 2, 3); say "something there" if @foo.elems # Failure spoiling things
camelia ( no output )
Nemokosch 👍 12:58
13:26 XliffMac left
guifa ugh I think my biggest frustration lately with Comma is that it doesn't keep code folder =/ 13:40
13:52 ab5tract joined, ab5tract left 13:59 Guest10 joined 14:00 Guest10 left 14:02 Guest10 joined, Guest10 is now known as XliffMac 14:08 razetime joined 14:14 XliffMac left 14:18 cacci joined 14:31 merp left 14:33 merp joined 14:34 jacob_c left 14:36 Guest10 joined 14:58 jacob_c joined 14:59 Xliff left 15:03 Guest10 left 15:05 Xliff joined
Xliff How can I HLLize a BootStr? 15:06
tellable6 2023-03-19T15:02:48Z #raku-dev <lizmat> Xliff: fwiw, I don't see anything in the change log that immediately jumps out as a possible reason
Xliff I'm introspecting symbol tables, so I kinda expected this but was hoping for an easy solution.
lizmat nqp::hllizefor($item,'Raku') ?
Xliff Thanks! 15:07
Error; "Could not find nqp::hllizefor, did you forget 'use nqp;' ?" 15:09
And no... the "use nqp;" is there.
lizmat nqp::hllize($item) ? 15:12
Xliff That was my first attempt.
Same error.
lizmat nqp::hllize is used quite a lot in the core 15:13
15:13 jacob_c left
lizmat and nqp::hllizefor is used in dispatchers 15:13
Xliff And still getting this... Cannot resolve caller print(Str:D: BOOTStr) 15:17
So Stashes have BOOTStr objects which can get through to Raku. 15:18
Especially if you use MY
The funny thing is that I can print these just fine if I use .keys.gist
Just not if I use say 15:19
lizmat m: my int $a = 42; dd MY::<$a> # seems like natives are also a bit iffy 15:20
camelia Lexical with name '$a' has a different type in this frame
in block <unit> at <tmp> line 1
Xliff Ahh! The BootSTR was a type object! Adding a guard solved it. 15:23
15:24 tejr left 15:25 cfa joined
Xliff Is there a way to get OUTER::MY? 15:26
(I'm sure that's not it...)
Coz MY.WHO.keys is giving me: 'CompUnit' 15:28
And I was getting different results in my isolation tests. 15:29
lizmat the OUTER is the MY of the outer scope 15:30
m: my $a = 42; { say OUTER::<$a> }
camelia 42
15:30 tejr joined
Xliff So is there a way to get the OUTER-most scope? 15:31
lizmat m: my $a = 42; { { say OUTER::OUTER::<$a> } }
camelia 42
lizmat you mean the compunit? 15:32
Xliff I am trying to get a list of loaded compunits from within a compunit. Is that possible?>
lizmat keep going OUTER until you have one with the "!UNIT_MARKER" key init
*in it
guifa is there a QAD way to have two subs, one that's a Rakudo-specific (via nqp) and the other a future-proofed/compiler-agnostic vanilla Raku one? 15:34
Xliff lizmat: How would that look like in a loop? 15:35
guifa right now I'm doing multi with a BEGIN statement to produce a named arg flag. Would be nice to do that within the proto, so I dont ned to do it at each call time, but then I also thought that a non-Rakudo compilter would probably bomb when it saw NQP statements 15:36
Xliff Well... OUTER::OUTER::OUTER worked. I guess I'll have to hardcode that one for now! 15:37
lizmat the exact syntax escapes me at the moment: vrurg probably whips that out of their sleeve just like that 15:38
15:39 initrd joined 15:55 cfa left
ugexe isnt there something like OUTERS:: that already does that? 16:12
i guess that doesn't help find the one with unit_marker though 16:13
lucs I'd like to supply a sample program that will use a Foo::Bar module that I play to distribute. 16:19
Do people do this?
And if so, is there a "standard" name for such programs, "sample-foo-bar.raku" for example? 16:20
And would it appear in the META6.json under "provides": {"sample-foo-bar.raku": "bin/sample-foo-bar.raku"…}?
("plan", not "play") 16:21
ugexe well, listing bin files in provides doesn't do anything 16:23
they should get listed in the meta6.json somewhere yeah, but putting them in provides isn't it
and that somewhere has to be invented/designed or whatever by someone still
i'd probably put them in something like bin/example/foo-bar.raku personally, but putting them in bin/ is also fine assuming they aren't named something that might shadow a non-sample program 16:25
like naming a sample program 'grep' is obviously a bad idea
you could also just put them into an examples/ directory that people run inside your repo. its unlikely people are going to care about the sample/example program being installed, and indeed they actually probably would prefer it not to be since they wouldn't be able to modify the source and play with it really (just run it) 16:28
i mention that cause thats what i seem to have done with github.com/ugexe/Raku-Text--Table-...n/examples
lucs Hmm... Yeah, ./examples/ in the repo is a good idea (and indeed probably sufficient). 16:31
16:40 grondilu joined
lucs I see that some programs get installed in for example <…/rakubrew/versions/moar-2023.02/share/perl6/site/bin>. 16:44
Looks like they had been present in a <./bin> dir. in the original repo.
But I'm not sure why/how they moved from the repo to the install (I checked a few repos, and they indeed don't appear in the META6.json file).
I suppose it's zef that's doing that -- I should reread its docs :) 16:47
ugexe everything in bin/ gets installed. thats just cause how it always was 16:49
lucs Oh, okay.
ugexe see my earlier comment about how we should have something for listing them in meta6.json
lucs Yep.
ugexe there does need to be some distinction for including raku vs non-raku bin scripts for example
lucs Oh, right. I just remembered that I tried installing a local module with a ./bin/foo.sh executable. 16:50
ugexe like who knows if bin/zef is a raku script and can be precompiled or invoked the way we do with raku script wrappers, or if its a non-raku script which won't work once installed because of e.g. trying to invoke it as a perl module
16:51 bigdata joined
lucs The foo.sh got wrapped (you know that) and it just didn't work. 16:51
ugexe yeah
lucs On the other hand, it forced me to rething the script and to make it full Raku, which turned out to be a lot nice. 16:52
ugexe yeah, right now the workaround would be to put the non-raku code in resources somewhere, and include a thing raku wrapper script to invoke that script from resources 16:54
'course that also means a wrapper module to get access to $*DISTRIBUTION / %?RESOURCES from the bin script itself
lucs I'm thinking of building a module that would supply a number of sound files (*.wav or something) that would need to be found by the running module. 16:56
Can this be currently done?
(Not asking for the details right now, later maybe :) 16:57
guifa yes 17:02
that would go into resources/
and then referenced via %?RESOURCES<name-of-file>
lucs Aha, cool, thanks.
Hmm... Are name collisions something to beware of? (resources supplied by other modules...) 17:03
guifa no, they're linked with your module 17:10
lucs Ah, beautiful.
17:11 razetime left
Xliff If I wanted to get the days between two DateTime objects, what would be the best way to do it? 17:26
lizmat Xliff: convert them to .Date and subtract ? 17:30
or convert them to Instants and get a Duration / 86400 ?
guifa define "days" first :-) 17:32
Xliff lizmat++, guifa++ 17:52
I used github.com/Xliff/raku-Duration-Units, instead... ;) 17:54
17:54 simcop2387 left 17:55 perlbot left, Xliff left
lizmat sadly lacking in documentation :-( 17:56
18:00 reportable6 left, reportable6 joined 18:02 Sgeo joined 18:03 simcop2387 joined
guifa wait does augment work now? I think that was NYI 18:07
18:08 simcop2387 left
guifa actually I think I'm thinking supersede 18:10
18:11 simcop2387 joined
lizmat yeah, supersede is a no go 18:11
guifa still dreams of the day of `supersede class DateTime { … }` mwahahahahahha 18:12
With new-disp, does augmenting still have as strong of a perf hit? 18:14
18:22 perlbot joined
lizmat guifa: if you want something like that, we should look at lexical refinement 18:23
aka, add a method to a standard class in a lexical scope
guifa wants it globally though haha 18:24
but you know my deal with DateTime ha
18:26 jacob_c joined 18:33 jacob_c left 18:50 teatwo left, teatwo joined 19:08 Sgeo left 19:23 tea3po joined 19:25 jpn joined 19:26 teatwo left 19:28 codesections left, grondilu left 19:36 Sgeo joined 19:46 guifa_ joined 19:48 jpn left 19:49 guifa left 19:50 jpn joined 20:13 jpn left
vrurg .tell Xliff I haven't followed the full context of your question about OUTER, but what you probably need to iterate over out contexts is .WHO<OUTER> 20:51
tellable6 vrurg, I'll pass your message to Xliff
20:52 jpn joined 20:57 bigdata left 21:04 jpn left 21:37 Sauvin left 21:39 rf joined
rf Afternoon folks 21:40
21:40 Sauvin joined
Nemokosch Forenight 21:56
22:06 jgaz joined
rf lizmat: There will be a blog post by me tonight, was out and about all weekend now I have time :) 22:29
22:36 jpn joined 22:42 jpn left 22:47 initrd left 22:57 jgaz left