🦋 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.
lizmat Anton Antonov type in article: “FuncitonalParsers” 11:00
*typo :-)
tbrowder__ tonyo: i thought you lived nearer the coast. 11:26
[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
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
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
El_Che make it github.com/raku/raku.org so it's clickable on terminals :) 15:05
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
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
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
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
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
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
Xliff \o 18:02
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
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
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
evalable6 see 19:26
moritz_ kueppo: please use a pastebin if you have more than one line of code that you want to show us 19:38
ToddAndMargo I forgot to add where I got the installer from: github.com/nxadm/rakudo-pkg/releases 19:47
kueppo termbin.com/pm5z 19:55
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
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
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.
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;
}
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
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
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