01:02 kjp left 01:03 kjp joined 01:04 kjp left 01:05 kjp joined 01:35 CultOfTheGlenda joined
CultOfTheGlenda Good morning. I probably have another stupid question. I want to add some sort of operator or language construct. It will look something like 01:39
do-when $t {
  #some callable here
}
In this case $t is a DateTime. I can achieve what I want by using a subroutine or prefix operator for the most part but I have to use a comma after the $t. Essentially I want that gone.
I think I've read that things like for loops are written in raku in an operator or grammar. That is basically what I am looking to do. If someone could point me to that, that would be great. Just trying to learn more of the deeper innerworkings. Thanks guys. 01:46
Voldenet I think there is such operator already 01:50
m: my $x = DateTime.now; with $x { .say }; # defined 01:51
camelia 2025-09-25T03:51:25.061270+02:00
Voldenet m: my DateTime $x;; with $x { .say }; # not defined
camelia ( no output )
Voldenet s/operator/keyword/
there are plenty of ways to do exactly what you want or something similar - the easiest (but not precisely what you want) is a sub 01:53
m: sub do-when ($y, &x) { with $y { x($y) } }; do-when DateTime.now, { .say } # no hacking, boring code
camelia 2025-09-25T03:54:00.063156+02:00 01:54
Voldenet it requires `,` after the parameter, so it's not as good
CultOfTheGlenda Yeah, this is an exercise to learn more about raku(do). What's the hard way? 01:56
Voldenet other option is a slang (where you add subrules to a grammar) - it's sufficiently complex at the moment because of QAST/RakuAST differences 01:57
github.com/0racle/raku-Slang-Other...ree/master example slang, but you can find more in raku.lang
raku.land* 01:58
CultOfTheGlenda Thanks, I was afraid slang was the way. That comma is looking better already. 01:59
Voldenet I think the most modern way would be rakuast macros
there's also keywords on the HOW levels, but I think they're limited to defining class-like keywords, maybe I'm not seeing bigger picture though 02:00
example of that approach (probably not applicable to defining entirely new syntax) github.com/raku-community-modules/.../tree/main 02:01
CultOfTheGlenda One thing that confuses me about raku is arrays in a hashmap. I will then point another array at that nested array thusly
my @ss := %hashmap<key-that-points-to-array>;
When I do that @ss becomes a nested array. Why is that?
I've been doing raku for years now, and that still trips me up. 02:02
Voldenet m: my %x = a => [1]; say %x<a>; my @n := %x<a>; say @n 02:03
camelia [1]
[1]
Voldenet you mean the above?
m: my %x = a => [1]; say %x<a>; my @n := %x<a>; say @n; my @nested = %x<a>; 02:04
camelia [1]
[1]
Voldenet m: my %x = a => [1]; say %x<a>; my @n := %x<a>; say @n; my @nested = %x<a>; say @nested
camelia [1]
[1]
[[1]]
Voldenet the last one copies the scalar that contains an array 02:07
you can see incarnations of this in many places 02:08
m: my %x = a => [1, 2, 3]; for %x<a> { .say }
camelia [1 2 3]
.landyacht. m: my %x = a => [1, 2, 3]; for @%x<a> { .say } 02:09
evalable6 (exit code 1) Type List does not support associative indexing.
in block <unit> at /tmp/Szu2Abr8kU line 1
.landyacht. ay?
m: my %x = a => [1, 2, 3]; for @(%x<a>) { .say }
evalable6 1
2
3
Voldenet The above is what I used to do, but
.landyacht. eesh, don't love that...
Voldenet it's not quite right
it calls .list on that and COPIES the contents
but what you can do is say "I don't want the container but the contents" 02:10
m: my %x = a => [1, 2, 3]; for %x<a><> { .say }
camelia 1
2
3
.landyacht. I'm sure I remember this working this way to make something else DWIM nicely, but I can't for the life of me remember what that thing is
Voldenet m: my %x = a => [1, 2, 3]; for %x<a>.list { .say } # this is doing the same as @(…) version 02:13
camelia 1
2
3
Voldenet lists aren't expensive, but at the moment I think they're allocated, so they're not as free as the version with <> 02:16
there's also Slip version of it, but I don't know how that internally works 02:24
m: my %x = a => [1, 2, 3]; for |%x<a> { .say } # the same as %x<a>.Slip 02:25
camelia 1
2
3
Voldenet Slip also probably copies the list, that's what benchmarks suggest at the moment: 0x0.st/KmV7.raku 02:36
02:43 greaser|q left, greaser|q joined, greaser|q is now known as GreaseMonkey
cultoftheglenda Back on discord. Thanks for all the information guys. 03:26
CultOfTheGlenda What would the performance impact be of a shlang? 03:59
04:07 CultOfTheGlenda left
Voldenet CultOfTheGlenda: altering the grammar takes up to 1s, but after that there's hardly any impact 04:11
tellable6 Voldenet, I'll pass your message to CultOfTheGlenda
04:34 derpydoo joined 05:24 Aedil joined, derpydoo left 05:34 Sgeo left 05:50 melezhik joined 06:06 abraxxa joined 06:31 derpydoo joined 07:20 melezhik_ joined
melezhik_ .tell ds7832: - please take a look at Sparky - looks good for your tasks IMHO - gist.github.com/melezhik/d1f42e5ef...ef5da5b879 07:27
tellable6 melezhik_, I'll pass your message to ds7832
07:27 melezhik_ left
Geth raku.org/Inline-Perl5: a2896f6a79 | librasteve++ | lib/Org/Home.rakumod
tweak code example
07:53
raku.org/main: da5a0cd6dc | librasteve++ | lib/Org/Home.rakumod
add CPAN vignette
07:55
raku.org/main: a2896f6a79 | librasteve++ | lib/Org/Home.rakumod
tweak code example
raku.org/main: f50d23d8d1 | librasteve++ (committed using GitHub Web editor) | lib/Org/Home.rakumod
Merge pull request #265 from Raku/Inline-Perl5

add CPAN vignette
08:00 lichtkind joined 08:12 dakkar joined 09:50 melezhik left 10:24 lizmat left, guifa_ joined, lizmat joined, slu left, atweedie left, BooK left, atweedie joined, guifa left, leont left, BooK joined, zostay left, skaji__ left, rjbs left, leont joined, zostay joined, rjbs joined, skaji__ joined, slu joined, GreaseMonkey left 10:25 greaser|q joined 10:27 apac joined 10:36 apac left 10:39 apac joined
tbrowder Cool docs tweak, even I get it! 10:46
10:49 greaser|q left, greaser|q joined 10:50 greaser|q is now known as GreaseMonkey
ds7832 Can one easily handle D-Bus interfaces in Raku? 11:04
tellable6 2025-09-25T07:27:22Z #raku <melezhik_> ds7832: - please take a look at Sparky - looks good for your tasks IMHO - gist.github.com/melezhik/d1f42e5ef...ef5da5b879
antononcube This was asked / answered before here… Or maybe, for some other “buses.” 11:41
ds7832 In the IRC logs the last message on "dbus" or "d-bus" is one from October 2022, impliying that at that time there was no such module: <leont> Which shouldn't be too hard once we have a dbus module, but someone has to write that first 11:51
But since I couldn't find anything in the web, I do suspect that today too there's no module for that out there yet. 11:52
Perhaps there's something in the making though. 11:55
lizmat I guess using NativeCall and libdbus, it shouldn't be too hard to write a module for it 12:12
but I don't know anybody at this point working on that, maybe leont has some thoughts about it 12:13
leont Yeah it shouldn't be too hard.
I haven't worked on it because I'd want to write a gobject library first and that is actually harder. 12:14
12:36 ACfromTX left 12:38 MoC joined 12:40 ACfromTX joined
ab5tract leont: I wish I could manage to comprehend gi.readthedocs.io/en/latest/ 13:15
*GObject Introspection
13:43 apac left 13:49 derpydoo left
Geth raku.org/html404: bfa6d6746c | librasteve++ | 2 files
tweak code example
13:58
13:58 Sgeo joined
Geth raku.org: librasteve++ created pull request #266:
Add HTML 404 Response
14:00
14:09 lichtkind left
Geth raku.org/main: bfa6d6746c | librasteve++ | 2 files
tweak code example
14:10
raku.org/main: 34e704130c | librasteve++ (committed using GitHub Web editor) | 2 files
Merge pull request #266 from Raku/html404

Add HTML 404 Response
14:26 lichtkind joined 15:00 stanrifkin joined 15:37 apac joined