This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
falsifian baughb: Another option: I recently used something like this: loop { my $line = get() || last; say "before: $line"; } (then keep calling get to get the rest of the lines) 00:26
Nemokosch: filed the bug: github.com/rakudo/rakudo/issues/5119 00:35
01:03 Kaipei left 01:16 razetime joined 01:52 deoac joined 01:55 razetime_ joined 01:56 razetime_ left, razetime left 02:26 deoac left
jaguart looking for a phaser to initialise a class-level hash once - INIT{ %h = {...} } or TWEAK{ if not %h.elems } - any comment? 02:50
MasterDuke can you just make it 'my' scoped? 02:53
guifa ^^ if it's in the class, it'll only get run once
MasterDuke m: class A { my %h = :1a, :2b; method foo($k) { say %h{$k} } }; my $a = A.new; $a.foo("b")     # like this 02:54
camelia 2
guifa m: class A { say "assigned!' and my %h = :1a, :2b; method foo($k) { say %h{$k} } }; my $a = A.new; my $b = A.new;
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$k' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> gned!' and my %h = :1a, :2b; method foo(⏏$k) { say %h{$k} } };…
02:55
guifa errr
MasterDuke m: class A { say "assigned!" and my %h = :1a, :2b; method foo($k) { say %h{$k} } }; my $a = A.new; my $b = A.new;   # you had a quoting typo 02:56
camelia assigned!
jaguart the hash is a shared lookup that is slow to initialise, and once initialised is read-only. I was thinking an out %h that gets initialised only once...
um s/out/our/
guifa You could do BEGIN my %h = ……; 02:57
That would evaluate it at compile time
jaguart thanks - actually the INIT phaser seems closer to where I want it 03:02
and seems to work :)
guifa The only difference between INIT and BEGIN is that BEGIN happens at compile time 03:03
and INIT happens at execution
class Foo { INIT my %h = … } and class Foo { my %h = … } shouldn't be noticeably different in speed, tbh.
jaguart oh interesting - no phaser at all... will play with that too, thanks 03:04
so that looks and feels nice - seems that my %h works as well as our %h and just doing the work in the assignment only gets executed when an instance is created. 03:20
as in only when the first instance is created
03:25 razetime joined 04:03 MasterDuke left 04:59 Heptite left 05:26 frost joined 06:06 razetime left 06:08 Kaipei joined 06:13 frost left 06:29 frost joined 08:36 frost left 09:08 dakkar joined 11:05 Kaipei left 12:04 Kaipei joined 12:40 discord-raku-bot left, discord-raku-bot joined 12:43 razetime joined 13:54 frost joined 14:47 Heptite joined 15:30 ToddAndMargo joined
ToddAndMargo Where do I go to report this bug?  vpaste.net/bQpz1 15:31
Nemokosch did you check how $?FILE works? 15:33
ToddAndMargo It works perfectly.  You will notice that I leave the .bat file on the drive after I run it (new calls just overwrite it).  This is so I can test the bat independently of raku, if need be.   And yes, checking the .bat file was the first thing I did.   What is really annoying is on my W11 machine, I have ,pm6 set in my registry to open with 15:40
notepad for easy editing.   qqx starts notepad and loads it with the source code of the module.  I use this sub a lot, so I decided to put it into a module and that is where this qx bug surfaces.  Where is the appropriate place for me to post this bug?
Nemokosch It's just I'm not convinced if this is a bug in the first place 15:44
ToddAndMargo run the code and see for yourself 15:45
Nemokosch first off, what you are dealing with is a .pm6.bat file because you concatenate a path string and ".bat" 15:46
ToddAndMargo take out the comment marks before the prints and watch the sub do its thing.  Keep in mind, the issue is running the sub from a module,  Directly inside your pl6 15:47
that is what it is support to do.  It takes the name of the program and tacks .bat at the end.  THis gets me around the %temp% file problem 15:48
Directly inside your pl6, it runs perfectly and have now for me for about two years 15:49
15:49 discord-raku-bot left, discord-raku-bot joined
ToddAndMargo Directly inside your pl6, it runs perfectly and have now for me for about two years 15:49
This the proper place?  github.com/rakudo/rakudo/issues/new 15:52
Nemokosch don't forget that even if you compile it, the file path would be burned into the compiled module 15:54
that part is intended
ToddAndMargo >raku -e "use lib '.'; use RunCmdModule :RunCmd; say RunCmd(Q[ls]); 16:00
K:\Windows\NtUtil\RunCmdModule.pm6 (RunCmdModule).bat
ls
there is nothing wrong with the .bat fiel name and path 16:01
got to go for now.  Thank you for the help 16:02
16:02 ToddAndMargo left 17:04 dakkar left 17:05 dakkar joined 17:39 dakkar left 18:05 razetime left 19:28 jgaz joined 21:20 NemokoschKiwi joined 21:50 lizmat joined 21:57 Kaiepi joined 22:03 NemokoschKiwi left 22:36 Kaiepi left 22:37 Kaiepi joined
jaguart Does anyone have any good resources for keeping raku up-to-date in production? e.g. like Debian's unattended-upgrades - and this for both raku and the installed modules? 23:07
Would also be interested in approach to bootstrapping Raku on a reasonable number of Linux hosts (say 10 - 20) ala ansible, puppet etc 23:08
lizmat just Raku, or also modules ?
jaguart looking for both :) 23:13
lizmat raku comes in various Linux packages 23:15
jaguart So far my best experience has been using rakubrew
lizmat nxadm.github.io/rakudo-pkg/
jaguart Oh - that is nice :) 23:16
lizmat and I guess one could create a distribution with all of the top level modules one would need, and then do a zef install that-dist --/test
jaguart I remember we chatted about that before 23:17
lizmat could well be :-) 23:19
I wonder whether we could automate making a "manifest" for a given program 23:20
perhaps something with RAKUDO_MODULE_DEBUG tweaking 23:21
jaguart Sounds like something that should be part of fez publication
lizmat I was more thinking along the line of something similar to %*ENV<RAKUDO_PRECOMPILATION_PROGRESS> in core 23:24
but instead it would take a filename to write all loaded modules to, and use that as a base to create a META6.json from
jaguart META6.json needs to become RAKU.json and it would def be great to auto-generate the "depends": [...] entry 23:27
or even RAKU.meta -> legacy META6.json, because then we could support #include directives etc 23:28
and RAKU.meta -> RAKU.json enables a mix of manual and auto properties 23:29
So a question on rakubrew - how to completely remove - is it as simple as ``rm -rf ~/.rakubrew`` - what about ~.raku? 23:30
lizmat that is slightly more complicated :-) 23:35
ugexe might have more ideas
jaguart the installation is beautifully documented :) 23:37
lizmat has never used rakubrew, so wouldn't know 23:38
jaguart I assume you just use a single version of raku for everything on the host?
~/.raku looks like a mix of repl and zef things 23:41
lizmat yeah... 23:43
lizmat calls it a day :-) 23:44
jaguart Thanks for the pointer to nxadm-pkgs/rakudo-pkg - I do search before asking, but never seem to find the good raku stuff - didnt know about raku.land until I asked here 23:45