🦋 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:01 bigdata joined 00:03 bigdata left 00:07 reportable6 left 00:09 reportable6 joined 00:58 jgaz left 01:19 deoac joined 01:27 frost joined 01:39 frost20 joined 01:42 frost left 01:58 deoac left 02:32 Sgeo left 02:33 squashable6 left, Sgeo joined, squashable6 joined 03:01 Sgeo left 03:02 razetime joined, Sgeo joined 03:03 HvszrStykp left 03:49 masukomi joined 03:59 masukomi left 04:03 Sgeo left 05:03 evalable6 left, quotable6 left, notable6 left, benchable6 left, linkable6 left, coverable6 left, tellable6 left, shareable6 left, squashable6 left, bisectable6 left, committable6 left, reportable6 left, sourceable6 left, statisfiable6 left, unicodable6 left, nativecallable6 left, greppable6 left, bloatable6 left, releasable6 left, quotable6 joined 05:04 unicodable6 joined, shareable6 joined, benchable6 joined, bisectable6 joined 05:05 bloatable6 joined, tellable6 joined, nativecallable6 joined, squashable6 joined, reportable6 joined, releasable6 joined, notable6 joined, linkable6 joined, statisfiable6 joined 05:06 evalable6 joined, coverable6 joined, committable6 joined, greppable6 joined, sourceable6 joined 05:09 HvszrStykp joined 05:16 Xliff left 06:02 abraxxa joined 06:07 abraxxa left, reportable6 left, abraxxa joined 06:08 reportable6 joined 06:17 Sgeo joined
lizmat [Coke] Thanks, fixed! 07:02
07:08 MoC joined 07:12 bb01100100 joined 07:21 lichtkind joined 07:31 Sgeo left 07:35 silug left 07:42 haxxelotto joined 07:47 silug joined 07:53 ircuser_ joined 08:10 dakkar joined 08:11 razetime left 08:27 razetime joined 08:37 labster joined 09:12 lichtkind left 09:29 sena_kun joined 09:32 bb01100100 left 09:48 frost20 left 09:57 Guest59 joined
Guest59 Hi 09:58
09:58 Guest59 left
Kernspin Good noon. It is exactly 12 AM o'clock. 10:01
Nemokosch same 10:02
okay 1 minute off 😄
10:13 ircuser_ is now known as merpaderp 10:16 equinox joined 10:38 labster left
Geth planet.raku.org: f10772d266 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | perlanetrc
Add lizmat's dev.to feed
10:48
planet.raku.org: 88a4ca7cc8 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | perlanetrc
Adapt title, didn't realize that's shown on the raku.org homepage
11:08
11:10 equinox6 joined 11:14 equinox left 11:18 Matthew|m left, tadzik left, AlexDaniel left, crystalfrost[m] left, andrea[m] left, CIAvash left 11:23 leah2 left 11:26 CIAvash joined 11:42 Xliff joined 11:54 AlexDaniel joined, crystalfrost[m] joined, Matthew|m joined, tadzik joined, andrea[m] joined 11:57 jgaz joined 12:07 leah2 joined 12:08 reportable6 left, reportable6 joined 12:29 amenonsen left, amenonsen joined 12:32 jgaz left 12:34 amenonsen left, amenonsen joined 12:37 amenonsen left 12:38 amenonsen joined 12:41 jgaz joined, masukomi joined 12:44 equinox6 left 12:49 jetchisel left 12:51 derpydoo joined, Altai-man joined 12:52 jetchisel joined 12:55 sena_kun left 13:09 silug left 13:11 Altai-man left 13:12 Altai-man joined 13:30 Sgeo joined
tbrowder .tell tony the code seems to be fully working now. all the current tests work with mi6 test. but more tests are needed “of course” 13:39
tellable6 tbrowder, I'll pass your message to Tony_ 13:40
tbrowder .tell tonyo ^^^
tellable6 tbrowder, I'll pass your message to tonyo
13:41 razetime left 13:46 derpydoo left
tonyo tbrowder: nice, is that going without eval? 13:48
been dealing with production problems the last couple of days and haven't had time for much else
tbrowder no, it’s using EVAL
13:48 vrurg left 13:49 vrurg joined
tbrowder it needs internal code cleanup, but the design works. i would like to avoid the unique class name problem, but that can wait for a PR from the raku pros 13:51
14:01 Altai-man left, masukomi left, Xliff left, crystalfrost[m] left, mtj left, goblin left, ecocode left, ecocode joined, goblin joined 14:02 Xliff joined, Altai-man joined, mtj joined 14:04 derpydoo joined 14:06 crystalfrost[m] joined 14:13 haxxelotto left 15:05 equinox joined 15:25 razetime joined 15:27 japhb left, abraxxa left 15:34 japhb joined 15:47 lichtkind joined 16:30 dakkar left
tonyo there is a way to name anonymous classes but i'm failing to recall what it is 16:42
16:43 Altai-man left
[Coke] .^set_name("FOO"), and then .^compose, maybe? 16:53
(though I cannot do that and make FOO.new work, so I'm missing something
m: my $a = anon class { method hi{say "hi"}}; $a.^set_name("Foo"); $a.^compose; dd $a.new 16:59
camelia Foo.new
[Coke] but Foo.new at that point, or even ::("Foo").new don't work. Missing a step
lizmat when you do Foo.new, the "Foo" needs to live somewhere lexically visible 17:00
that the anonymous class thinks of itself as "Foo" doesn't help in this search 17:01
you would need to bind the anonymous class to "Foo" somewhere
[Coke] ah, fair. I think I thought the compose would do that. 17:02
lizmat m: my \Foo = class { has $.a = 42 }; dd Foo.new.a
camelia 42
lizmat I don't think ^compose does that, or is expected to do that
.^compose is mostly about clearing / re-initalizing any caches 17:03
[Coke] is there a MOP method we could use to add a class in with a name? 17:11
lizmat perhaps this can be an inspiration: 17:14
m: my constant \Foo = package { }; BEGIN Foo::<Bar> := class { has $.a = 42 }; dd Foo::Bar.new.a
camelia 42
lizmat the problem is really that if you do Foo::Bar.new, the Foo::Bar must exist at compile time 17:16
[Coke] lizmat++
lizmat a runtime version:
[Coke] m: m: my constant \Foo = package { }; Foo::<Bar> := class { has $.a = 42 }; ::("Foo:Bar").new.a;
camelia No such symbol 'Foo:Bar'
in block <unit> at <tmp> line 1
lizmat m: my \Foo = package { }; Foo::<Bar> := class { has $.a = 42 }; dd Foo::<Bar>.new.a
camelia 42
lizmat yup, you got the idea :-) 17:17
[Coke] m: m: my constant \Foo = package { }; Foo::<Bar> := class { has $.a = 42 }; ::("Foo::Bar").new.a;
camelia ( no output )
[Coke] so if you can't guarantee it's there at compile time, you can always look it up at runtime.
17:22 equinox left
lizmat indeed 17:22
although, now that we have newdisp, you could argue that the Foo::Bar lookup should be at runtime
I believe the compile timedness of such lookups was mostly a efficiency thing 17:23
[Coke] That change would have to go in over a language bump, probably? 17:24
lizmat well, perhaps 17:33
probably, yes
18:01 masukomi joined 18:02 razetime left 18:06 sena_kun joined 18:08 reportable6 left 18:09 reportable6 joined 18:51 hythm joined
hythm m: my @a = 1, 2, 3; @a.hyper.map(*.say); 18:58
camelia 1
2
3
tellable6 2022-10-12T09:30:15Z #raku <lizmat> hythm: END try self.some-method()
hythm an array can be hyper iterated like above. but is there a way to ask an array to be hypered anytime it is iterated, without explicitly calling `hyper` before `map`? something like  `@a .= hyper; @a.map(*.say);` 19:01
m: my @a = 1, 2, 3; @a .= hyper(); @a.map(*.say) ## and I be sure that the map call will be hypred? 19:03
camelia 1
2
3
hythm What I'm trying to do is to call hyper based on a condition, and the map block of code is long, so to avoid duplicating the long code block inside map, I 'd like to do something like `@a .= hyper if $condition; @a.map: ...` 19:10
19:27 masukomi left 19:43 MoC left, [Coke]__ joined 19:46 [Coke] left 19:47 [Coke]__ is now known as [Coke] 20:04 labster joined
lizmat m: my @a = ^10; my $s := 0 ?? @a.hyper !! @a; my @b = $s.map: { 42 }; dd @b # hythm 20:05
camelia Array @b = [42, 42, 42, 42, 42, 42, 42, 42, 42, 42]
lizmat m: my @a = ^10; my $s := 1 ?? @a.hyper !! @a; my @b = $s.map: { 42 }; dd @b # hythm
camelia Array @b = [42, 42, 42, 42, 42, 42, 42, 42, 42, 42]
lizmat m: 'my @a = ^10; my $s := 1 ?? @a.hyper !! @a.Seq; my @b = $s.map: { 42 }; dd @b @ perhaps clearer 20:06
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> s.map: { 42 }; dd @b @ perhaps clearer⏏<EOL>
expecting …
lizmat m: my @a = ^10; my $s := 1 ?? @a.hyper !! @a.Seq; my @b = $s.map: { 42 }; dd @b @ perhaps clearer 20:07
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> !! @a.Seq; my @b = $s.map: { 42 }; dd @b⏏ @ perhaps clearer
expecting any of:
infix
infix stopper
postfix
ugexe probably not good to mix something that you typically want to work lazily with something you almost never want to work lazily
lizmat m: my @a = ^10; my $s := 1 ?? @a.hyper !! @a.Seq; my @b = $s.map: { 42 }; dd @b # perhaps clearer
camelia Array @b = [42, 42, 42, 42, 42, 42, 42, 42, 42, 42]
ugexe i'd probably just always hyper but with :degree(1),:batch(1) if i wanted map-like behavior
lizmat I guess :degree(1) should be enough, and not do any hypering at all and just return an ordinary Seq 20:08
20:09 masukomi joined
masukomi is there any builtin function i could use to execute a shell command and stream the output? For example, if i wanted to make a script that let users start "top" running and just stream the ever-changing top output to them. 20:10
Nemokosch Proc::Async? 20:11
docs.raku.org/type/Proc::Async there is an example 20:12
masukomi hmm. yeah maybe. I wonder if there's a way to just wire it's output directly to stdout rather than the "react" mechanism 20:13
Nemokosch I mean... if you don't want to do anything with the output, why don't you just downright call the process? 😄 20:15
ugexe all the proc ops use stdout/stderr as the default handles
m: shell("top") 20:16
camelia The spawned command 'top' exited unsuccessfully (exit code: 1, signal: 0)
in block <unit> at <tmp> line 1
masukomi outside of raku? i can, and i do, but in this context it's "here's info about something... oh hey, there's an asiiinema recording for it. would you like me to play it?" I'd like to actually play it for the person not force them to run a separate command.
20:17 sena_kun left
ugexe maybe you should just try 20:17
masukomi yeah, am about to. ;)
20:18 sena_kun joined
ugexe my $proc = run("top", :out); $proc.out.Supply.tap: { say $_ }; loop {}; $proc.out.close() 20:19
Nemokosch Are you sure this would work, with the infinite loop? Did nothing for me 20:21
but yeah `shell('top')` just works for running a process to completion
masukomi the top example looks terrible when run. my similar test of running asciinema works but screws up formatting 20:22
ugexe yes that works with the infinite loop
Nemokosch then I don't know what I'm doing wrong 20:23
masukomi the top one seems to be ignoring / loosing escape codes that result in lines being redrawn and is, instead just streaming a constant list
Nemokosch for me, it just freezes the REPL, inline script also
masukomi ah, i didn't run it in a repl. i figured that was pretty much guaranteed to introduce weirdness 20:24
ugexe 🤷 works for me raku -e 'my $proc = run("top", :out); $proc.out.Supply.tap: { say $_ }; loop {}; $proc.out.close()'
Nemokosch didn't work with `raku -e` either, mind you 20:25
I wonder what it would produce
will check on the physical Ubuntu as well
masukomi i took ugexe's line and stuck it in an executable. here's a video of the result share.cleanshot.com/lxEm9s 20:26
Nemokosch Anyway, embedding top into a script doesn't sound like a good idea 20:27
interesting xdd
ugexe if you dont want to process the output then just do the previously mentioned shell("top") or run("top")
my example should probably use print instead of say as well 20:28
Nemokosch is top even meant to produce processable output? 20:29
masukomi uh.... shell("asciinema play path/to/foo.cast") works perfectly. I didn't even try it because i assumed it couldn't possibly be that easy.
shell("top") ALSO works perfectly 20:30
20:30 hythm28 joined
masukomi i'm .... astounded. free beer on me to whoever made that work so flawlessly. 20:31
20:32 labster left
Nemokosch nope, doesn't work on physical machine, Ubuntu 20.04, Cinnamon's default terminal either 20:32
or xterm for what it's worth 20:33
hythm28 Thanks lizmat & ugexe. Im away from computer at the moment, will try later.  Does `@a.hyper(:1degree).map` has performance penality if used instead of `@a.map` ? 20:34
masukomi do you have it in a simple executable file with just a shebang line and a shell("top") line? That's all i did. I'm on macOS though. 20:35
Nemokosch masukomi: embedding shell execution was easy in Python and even in C, using `system`... however, my special favorite is the qx quoting
which sends the output straight back as a string
no, that works, I meant ugexe's example 20:37
tbh the qx quoting is among the reasons I started Raku 😅
the final push was that I was annoyed by the boilerplate Python required for shell interactions 20:38
20:40 hythm28 left
these inline shell quotes are excellent when you half know the tools 20:40
you don't have to suddenly get deep into either the APIs for Raku for the CLI of a more sophisticated command-line tool, you can just glue something in two minutes 20:41
and the pleasure and usefulness will fuel the learning
20:54 hythm28 joined
masukomi yeah, i'm SO very impressed at how much better raku is at CLI tools than... literally everything else. So much work has been put into supporting that kind of tool making. 21:00
21:06 hythm28 left 21:13 labster joined 21:32 euandreh left 21:34 euandreh joined 21:38 derpydoo left
guifa_ sena_kun: you work on Comma, right? 21:42
sena_kun guifa_, yes 21:43
yes, we lost last month release
guifa_ no not that lol
sena_kun no, we'll do one this month 21:44
guifa_ the billing system is down.
sena_kun oh
that's bad
down as in?
guifa_ insert fry_take_my_money.gif
It's giving an error on using Stripe, saying that the administrator needs to complete some kind of set up
sena_kun thanks a lot for letting me know
guifa_ I'll PM you the exact message
sena_kun we'll sort it out ASAP (well, tomorrow I hope) 21:45
21:57 lichtkind left 21:58 epony left 21:59 epony joined 22:00 jgaz left, labster left 22:01 sena_kun left 22:02 jjido joined
Nemokosch Is it a good idea to put a global config file of a script into the resources folder? 22:10
22:25 haxxelotto joined 22:30 haxxelotto left 22:40 hythm left
ugexe thats what zef does 22:45
22:52 masukomi left
ugexe i would say its a good idea o put a "default" global config file in resources/, but if you expect users to edit configs then it should look somewhere like ~/.config/whatever/ first 23:00
users shouldnt be editing config files of installed modules afterall
23:02 masukomi joined, Nemokosch joined
Nemokosch Then I don't know why it wouldn't work... 23:02
Hm, wait... are resources not exposed to files in the bin/ folder? 23:04
ugexe ah right yeah, same with test files 23:05
23:05 masukomi left
ugexe i always write my scripts inside of a module e.g. MyModule::CLI and my bin scripts are `use MyModule::CLI;` 23:05
that allows your script to get precompiled as a side effect as well
Nemokosch Makes sense, although I feel I'm getting overkill with a zero dependency script that mostly just calls other CLI tools :D 23:07
ugexe thats pretty much all zef is 23:08
it also allows you to do stuff like
raku -MZef::CLI -e '' install Foo::Bar 23:09
23:09 masukomi joined
ugexe which, surprisingly, i've had uses for 23:09
like if multiple versions are installed, an easy way to invoke a specific one: `raku -e 'use Zef::CLI:ver<0.1>' install Foo::Bar` 23:11
23:18 kueppo joined
ugexe it also works as a command to run a script without first pointing PATH at e.g. site/bin 23:18
Nemokosch Anyway, thank you, useful learning 23:23
Time to go to sleep o/ 23:24
23:24 Nemokosch left