🦋 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:34 greaser|q left, greaser|q joined 00:59 jpn joined 01:03 MasterDuke joined 01:04 jpn left 02:04 linkable6 left, evalable6 left 02:06 evalable6 joined, linkable6 joined 02:24 tea3po joined 02:25 tea3po left 02:26 tea3po joined 02:27 teatwo left 02:50 zostay left, zostay joined 03:26 zapwai joined 03:34 zapwai left 04:12 holyghost left 05:12 linkable6 left, evalable6 left 05:13 linkable6 joined 05:15 evalable6 joined 06:00 reportable6 left 06:02 reportable6 joined 07:05 derpydoo left 07:12 squashable6 left, derpydoo joined 07:14 squashable6 joined 07:31 jpn joined 07:36 jpn left 07:38 jpn joined 07:43 jpn left 07:51 dakkar joined, jpn joined 07:56 squashable6 left, saint- left 07:57 jpn left 07:58 squashable6 joined 07:59 sivoais left 08:00 sivoais joined 08:02 eroux joined 08:07 Sgeo left 08:08 abraxxa joined 08:29 jpn joined 09:12 buffet left 09:22 abraxxa left 09:24 abraxxa joined 09:47 ToddAndMargo joined 10:03 coderboy joined, coderboy left 10:05 buffet joined 10:11 Xliff left 10:42 jpn left
lizmat Anton Antonov type in article: “FuncitonalParsers” 11:00
*typo :-)
tbrowder__ tonyo: i thought you lived nearer the coast. 11:26
11:32 elcaro left, elcaro joined 12:00 reportable6 left 12:01 reportable6 joined 12:18 jpn joined
[Coke] tbrowder__: I had started on a windows install cookbook and never finish it. will try to find the gist I had. 12:23
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/06/19/2023-...llections/ 12:34
12:36 ToddAndMargo left
Voldenet I like how tiobe treats raku as "successor of perl" :) 12:51
Geth raku.org: 009cc4cde5 | (Elizabeth Mattijsen)++ | source/index.html
The 2023 conference is now online, not in person
13:01
nemokosch > I’m glad I managed to bring far enough that others could see the potential and were excited enough to pick it up and run with it this is a good example of communication going either too euphemistic or downright wrong 13:04
RakuAST has been a promise for 6.e, it has been "the big thing" 13:05
and the way Jonathan left it behind (with little to no guidance or documentation, that is) should rather be something to learn from and not repeat again 13:09
13:50 linkable6 left, evalable6 left 13:52 linkable6 joined 13:53 evalable6 joined
tbrowder__ [Coke]: thanks. no rush now. i've discussed changing raku.org front page with patrickbr to be friendlier for windows ppl. i am working on a PR now. see raku.org issue #... 14:06
looking...update to old @trosel issue #72 14:08
comments on the github.com/raku/raku.org issue #72 are encouraged 14:13
14:23 teatwo joined, Sgeo joined 14:24 teatwo left 14:25 teatwo joined, avuserow left 14:26 avuserow joined, tea3po left 14:59 ToddAndMargo joined, ToddAndMargo left
El_Che make it github.com/raku/raku.org so it's clickable on terminals :) 15:05
15:36 somebody1807 joined
somebody1807 Is it practically possible to, using "trait_mod:<is>", wrap a method? I have been attempting it for the last 48 hours with little success. Is there some showstopping reason I'm unaware of? The goal is to, by applying a trait to a method, cause it to be protected by a Lock.protect call. 15:39
A lot of the problems seem to be stemming from trait_mod doing its business at compile time, unless I'm mistaken. 15:40
Here's a simple example of the issue I'm facing from my attempted solution: gitlab.com/-/snippets/2558851 15:43
It just spits out the unhelpful error: "Error while compiling" and "No such symbol 'Test'" 15:44
If I move the class definition into the same file as the main script, it works as expected... 15:46
tonyo tbrowder__: nah i live in bend, technically a desert @ 4k feet 15:47
15:49 abraxxa left
ugexe somebody1807: there are a couple of unrelated things wrong with that code. First, `state` isn't thread safe. Second, using a hash without protecting reads/writes is not thread safe. Third, using 'Test' as a import name is not a great idea because `use Test` will work regardless of your code (i.e. everyone has a Test module installed) 15:54
somebody1807 State, in this context, I believe doesn't need to be thread safe. This code block is only entered at that point during the compilation phase. I think the same also applies to the hash, in this instance, since it is only being modified during compilation 15:56
I have changed the class name as suggested, and the result appears to still be the same. 15:57
ugexe, do you have any idea for the resulting compilation error? 15:59
ugexe not really, you could proably add 'no precompilation' under 'unit class Test' to work around it 16:00
somebody1807 ... That seems to allow it to run. Wow.
Rakudo bug? 16:01
ugexe right. script dont get precompiled, so when you put it inside the script it also avoids the issu
probably a bug yeah
somebody1807 Does the module itself get compiled upon using it, or upon instantatiating it, if I use that "no precompilation" pragma? 16:03
Oh nevermind. I think it just means that delay to the programs start, from compiling that module, will be always present in the startup time. Not a big deal. 16:05
dakkar somebody1807: gist.github.com/dakkar/d1a44ad8feb...7cd3994d4e this seems to work for me 16:07
I've moved the lock into the object, because it's where it belongs (and your code leaks locks 😜) 16:08
I'm sure there's a sensible way to access a private lock, but I got confused and gave up 16:09
16:10 jpn left
somebody1807 I'm digesting it all, but can you expand a bit upon my code leaking locks? 16:11
You mean upon object destruction? 16:12
Yes I see you are right. Leaves things behind in the hash. Naughty me 16:14
16:14 jpn joined
gfldex somebody1807 dakkar please not that trait_mod:<is> will always be called on the proto is the method is a multi. You have to fiddle with the .candidates by hand in that case. 16:17
dakkar ah yes
gfldex And I think I forgot to file that Rakudobug. Thanks for reminding me!
dakkar wrapping a multi is trickier
somebody1807 The depth of raku is infinite. There is a long journey ahead 16:18
gfldex you may have a look at raku.land/cpan:JNTHN/OO::Monitors
somebody1807 Very useful for inspiration. Thank you. Do you have more information on that rakudo bug? I would be interested to learn more about it 16:19
16:20 jpn left
gfldex I will file a bug report later today. Need to run to the shop as I am all out of ice cream. 16:21
somebody1807 Good idea. Run to burn the calories in advance. Very efficient 16:22
dakkar `my $lock := self.^attribute_table(){$locked-by}.get_value(self);` ugh, works but feels ugly 16:34
(why doesn't `AttributeContainer` have a `find_attribute`?)
anyway, leaving now 16:35
somebody1807 Thanks for you help, by the way
*your
16:36 somebody1807 left 16:40 dakkar left 16:45 samebchase joined 17:10 jpn joined 17:17 jpn left
Geth raku.org: tbrowder++ created pull request #183:
Change the "Download" page to "Install" for a better non-Linux or new user experience
17:31
17:53 jpn joined 18:00 reportable6 left 18:02 Xliff joined
Xliff \o 18:02
18:02 reportable6 joined
Xliff Wow.... checking an RSA private key against its public counterpart is more work than I thought. 18:03
And I don't think the OpenSSL module has all of the necessary routines from libcrypto.
[Coke] anyone have any good powershell doc/example recommendations? 18:05
(Man, I wish I could write this in raku) 18:06
tbrowder__ tonyo: i drove through bend once long ago traveling from victorville ca to spokane wa area. very interesting scenery enroute. 18:34
18:38 ToddAndMargo joined
ToddAndMargo Hi Guys, Is this a bug or am I doing something wrong?  The /$0/$1 $2/  is not substituted.  vpaste.net/pxRm6 18:41
Type: should have been /$0$1 $2/ 18:42
18:54 abraxxa-home joined 19:03 jast left, jast joined 19:09 sena_kun joined 19:21 kueppo joined
kueppo Hello rakuders! 19:25
my @k = <1 3 4 5 6>;
my $p = start {
    my $f = 0;
    say "Hello";
evalable6 Hello
kueppo     say @k;
    @k.map: -> $i {
        say "look: $i"; 19:26
        sleep 1 if $f++ == 0;
    }
}
sleep 10;
say "see";
@k[0..2] = [10, 2, 9];
say @k;
await $p;
The above raku program prints this
Hello
19:26 silug left
evalable6 see 19:26
19:26 silug joined 19:30 kueppo left 19:31 silug left 19:32 silug joined 19:34 silug left 19:36 silug joined 19:37 kueppo joined
moritz_ kueppo: please use a pastebin if you have more than one line of code that you want to show us 19:38
19:47 jpn left
ToddAndMargo I forgot to add where I got the installer from: github.com/nxadm/rakudo-pkg/releases 19:47
19:53 abraxxa-home left, jpn joined
kueppo termbin.com/pm5z 19:55
19:55 abraxxa-home joined 19:58 ntdll90 joined
kueppo termbin.com/pxkx 19:58
so I have this output and I expected "see" to come after somehow before the "look"s, would like to know what I'm doing wrong.
moritz_ kueppo: the @k.map is lazy, is that intentional? 19:59
20:00 derpydoo left, jpn left
kueppo No, no. thought that we could only lazy a block/statement by prefixing it with the "lazy" keyword. 20:01
moritz_ if you write "eager @k.map", the "look" comes before the "see" output 20:02
the `start` blog returns a value, and in your case that's te lazy iterator of the @k.map 20:03
the "await" at the end breaks the laziness ("reifies" the iterator, as we say), which is why look is printed at all 20:04
kueppo ouch! understood, thank you. 20:05
20:05 Xliff left
moritz_ if you write `my \dummy = await $p` then you assing the lazy list to a dummy variable and never reify it, the "look"s are never printed 20:06
you're welcome
ntdll90 Guys, I've a troule to convert CArray[uint16] to Str. On Windows I'm calling FormatMessageW with its prototype sub FormatMessageW(uint32, Pointer is rw, uint32, uint32, CArray[uint16] is rw, uint32, Pointer is rw) is native("kernelbase.dll") returns uint32 {*}; buffer defining my @buf := CArray[uint16].new(0 xx 0x400). Then calling
FormatMessage(0x12ff, Pointer[void], $errcode, 0x400, @buf, @buf.elems, Pointer[void]); This calling is fine, buffer is filled. But I cannot to convert @buf into string representation.
20:07 PotatoGim_ left, atweedie left, atweedie joined, SmokeMachine left 20:08 Xliff joined, PotatoGim_ joined, SmokeMachine joined 20:09 TieUpYourCamel left, rypervenche left 20:10 rypervenche joined 20:11 kueppo63 joined 20:12 coleman left, coleman joined 20:13 kueppo left
ToddAndMargo Hi ntdll90, I am just a beginner.  The developers will have a pretty way of doing it, but this is hte way I do it: sub to-UTF8-c-str( Str $RakuStr ) returns CArray[uint8] is export( :to-UTF8-c-str )  { 20:13
   # Converts a UTF8 Raku string into a UTF8 little endian C string
   # Note: C Strings are always terminated with a nul.  WinAPI will malfunction without it
   my $CStr = CArray[uint8].new();
   # $CStr = CArray[uint8].new( $RakuStr.encode.list );
   # $CStr[ $CStr.elems ] = 0;
   $CStr = CArray[uint8].new( $RakuStr.encode.list, 0 );
   return $CStr;
}
sub to-UTF16-c-str( Str $RakuStr ) returns CArray[uint16] is export( :to-UTF16-c-str )  {
   # Converts a UTF8 Raku string into a UTF16 little endian C string
   # Note: C Strings are always terminated with a nul.  WinAPI will malfunction without it
   my $CStr = CArray[uint16].new();
   # $CStr = CArray[uint16].new( $RakuStr.encode.list );
   # $CStr[ $CStr.elems ] = 0;
   $CStr = CArray[uint16].new( $RakuStr.encode.list, 0 );  # add a nul to the end
   return $CStr;
}
20:15 TieUpYourCamel joined
ntdll90 Hi, ToddAndMargo! Thanks for your reply. But how it can solve my problem? 20:20
ToddAndMargo It converts a C Array string to Raku Str.  Maybe I misunderstand the issue. 20:27
Uoops I give to other way around. 20:28
try this  `curl -L vpaste.net/XmJSb -o -`    (My browsers will not display vpaste.net anymore.) 20:30
kueppo63 Another thing
Just aiming to unsderstand sync of share resources
termbin.com/c3sv
termbin.com/s9gyf
Here, the for loop takes into account what I append to the list
But here it seems like it just took a copy of the array as input, like it is a functional method so what is really happening under the hood?
termbin.com/e1qp 20:31
termbin.com/mnso
ToddAndMargo This is how to read teh vpaste I did on the regex issue I posted:
`curl -L vpaste.net/pxRm6 -o -` 20:32
20:34 sena_kun left
ntdll90 Doesn't work/ 20:39
raku has bring into endless cycle 20:40
Is there really no (?!:easy)? way to do it? 20:42
OK, don't fret. I'll find a way to convert it by myself. 20:48
20:48 ntdll90 left 20:53 Guest2884 joined 20:55 derpydoo joined, jpn joined
ToddAndMargo in your call, shouldn't @buf.elems be an integer, not an array.  I'd do a loop on @buf from 0 to @buf.elems-1, and convert each cell with chr() to a string. `~=` will append the next character to the string. 21:02
21:04 jpn left 21:29 kueppo63 left 22:00 greaser|q left 22:03 greaser|q joined 22:39 Guest2884 left 22:43 abraxxa-home left, greaser|q left 22:45 greaser|q joined 23:01 jpn joined 23:05 daxim left, jpn left 23:06 daxim joined 23:22 squashable6 left 23:25 squashable6 joined