🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
[Coke] codesections: is there some process that needs to occur to accept github.com/Raku/problem-solving/pull/325 ? 01:56
tonyo where's JJ goin? 02:13
melezhik .tell SmokeMachine I've added badges to SparkyCI , you need to go "My repos"-> "Badge" link . The service itself is still not stable, so sometime API becomes unavailable, sorry ahead of time, I am working on it, however not sure how soon I can nail it down ... 03:58
tellable6 melezhik, I'll pass your message to SmokeMachine
melezhik .tell SmokeMachine an example of badge for test GH project is here - github.com/melezhik/rakudist-teddy.../README.md 03:59
tellable6 melezhik, I'll pass your message to SmokeMachine
mavles Rolls a 6 sided dice and gets 1 05:03
CIAvash skimmed over www.reddit.com/r/rakulang/comments...n_object/, I'd appreciate it if people avoided down-votes and snarky comments 05:14
grondilu hi 06:59
Nemokosch Hello 07:16
I think you guys are putting way too much effort into reddit people who know everything better but it turns out there is one thing they really know better: shitposting 07:17
Anyway, if this is a way to get elaborate answers, I will collect the things that bother me and put them into one reddit post :) 07:23
Geth problem-solving: 4fc031ba7d | (Will Coleda)++ (committed using GitHub Web editor) | 2 files
Volunteer for Doc wrangling (#325)

Resolves #324 Force merged to be able to keep momentum.
07:28
grondilu m: sub ($a) { { my $a = $a; } } 07:32
camelia ===SORRY!=== Error while compiling <tmp>
Cannot use variable $a in declaration to initialize itself
at <tmp>:1
------> sub ($a) { { my $a = $⏏a; } }
expecting any of:
term
grondilu thought this was ok
I mean I'm creating a new lexical scope 07:33
Xliff P6-GLib just exceeded 680,000 LOC with raku-Dazzle's 112th commit! :> 07:34
github.com/Xliff/raku-Dazzle/commi...4d97102dd6 07:35
grondilu m: sub ($a) { { my $a = $OUTER::a; } } 07:43
camelia WARNINGS for <tmp>:
Useless use of anonymous sub, did you forget to provide a name? (line 1)
grondilu m: sub ($a) { { my $a = $OUTER::a; } }(pi)
camelia ( no output )
yauhen Uploaded file: uploads.kiwiirc.com/files/a78454df...pasted.txt 07:51
hi people. i have two versions of recurse 'dir'.
SmokeMachine .tell melezhik thanks! I’ll add that to Red! 07:52
tellable6 SmokeMachine, I'll pass your message to melezhik
yauhen found mistake. forget ))) 07:53
yauhen hi. i have problems with 'run' any process on windows. if i go it after starting raku from inside cmd after 'chcp 65001' everything works ok. but if i just start raku that i see incorrect symbols for non-unicode chars. can somebody help? i use command 'c:\rakudo\bin 08:35
i use command 'c:\rakudo\bin\raku.exe -I c:\rakudo\lib'. 08:36
dakkar "non-unicode"? 08:58
do you mean "non-ASCII"?
(printing non-ASCII characters in terminals is generally a mess, doing it portably to every OS/terminal/setting is sadly nearly impossible, but maybe rakudo can do it better than it does currently, sometimes) 08:59
also, what version of rakudo are you using?
yauhen default encoding was 866 (chcp) 09:02
v2022.04.
dakkar looks up what 886 is 09:06
866, even
ah yes, that would screw things up
so, keep in mind I haven't touched Windows in over 20 years… 09:07
my understanding is:
* your terminal (before `chcp 65001`) expects to receive bytes representing latin+cyrillic characters
* rakudo sends bytes representing the utf-8 encoding of any character 09:08
* you see apparently-random symbols on screen
I do not believe there is a way for rakudo to know what encoding your terminal expects, and I'm not sure it's a good idea for rakudo to forcibly change your terminal encoding 09:09
but I hope to be wrong on that
short version: you need `chcp 65001`
or a time machine to go back to the '70s and explain to software people back then that every byte stream needs to declare its encoding, even when it feels like it's a waste of bandwidth 09:11
Nemokosch 😂 09:12
grondilu maybe you can use 'run' in binary and do the encoding of the output yoursely 09:18
*yourself
yauhen "short version: you need `chcp 65001`"
yes. i use sometime cmd and starting raku from inside cmd. but i'd like start raku immediately and use correct output for 'dir'
dakkar oh, I may have mis-understood your problem
yauhen "maybe you can use 'run' in binary and do the encoding of the output yoursely" 09:19
i think 'shell <dir>' would work but i'd like use builtin functions
grondilu you could also make a batch file that starts raku in cmd 09:20
dakkar so the problem is that the strings returned by `dir` look wrong? can you show us a minimal program that exhibits the problem?
yauhen minimal program is `dir` :-)
grondilu so `run 'dir'`, right? 09:21
grondilu realizes `dir` is a raku routine too 09:22
m: dir
camelia Failed to get the directory contents of '/home/camelia': Failed to open dir: Permission denied
in block <unit> at <tmp> line 1
yauhen Uploaded file: uploads.kiwiirc.com/files/1fabce5e...%D0%B5.png
Uploaded file: uploads.kiwiirc.com/files/4e94a42e...%D0%B5.png
dakkar ooh, nice, thank you
so, I'm pretty sure everything I said above still stands 09:23
the `dir` function returns a list of `IO::Path` objects, each containing the name of an entry in the on-disk directory you asked for 09:24
grondilu isn't there a $*ENCODING variable or something, to specify specific default encoding? 09:24
dakkar when *printing* them, rakudo sends to the terminal a sequence of bytes representing the utf-8 encoding of the characters in strings 09:25
your terminal thinks it's getting cp866 bytes instead, and dutifully interprets them that way
result: apparent garbage
yauhen "so, I'm pretty sure everything I said above still stands"
it works so only because i made change for cmd on startup `chcp 65001`
@chcp 65001>nul
dakkar I'm pretty sure `chcp` tells *the terminal* what to expect 09:26
yauhen "I'm pretty sure `chcp` tells *the terminal* what to expect" 09:27
yes. and how can i say to Raku what to expect? something like `enc => 'this is Microsoft, Dude'`
dakkar you need to tell raku what to *produce*, not what to expect ☺
I'm checking if `$*OUT.encoding(...)` does anything useful
it should, but your preferred terminal encoding is almost certainly not supported 09:28
docs.raku.org/type/IO::Handle#method_encoding 09:29
so, summary:
* the data inside the program is "correct", you can check the length of the various path names, match them with regexes, &c
* rakudo can't (at the moment) produce the encoding you use for your terminal 09:30
* `chcp 65001` (in other words, using UTF-8 as terminal encoding) is the "correct" way to see the correct symbols when rakudo prints them out
yauhen there is no useful encoding for my case. something changes only for 'windows-125[1,2]' and 'windows-932'. another encodings causes error. 09:31
dakkar (and yes, I understand this is not a great situtation, I've already expressed my thoughts on the general mess…)
dakkar yes 09:31
the thing is not "this is Microsoft", the thing is "I'm using a Microsoft-specific encoding from the '90s that can't represent most of the characters that rakudo wants to use" 09:32
yauhen i'm understand
but if i can start Raku in correct encoding from outside cmd why i cannot start it correct without cmd? maybe there is some variable or process string that REPL use when start and i can modify this for myself? 09:34
dakkar as I understand it, you are changing the encoding of your *terminal*, not of rakudo
have you tried running `shell <chcp 65001>` from inside rakudo? 09:35
(I may be wrong here, as I don't use Windows…)
yauhen Uploaded file: uploads.kiwiirc.com/files/987898c7...%D0%B5.png 09:54
dakkar well, *something* changed
but at this point I've reached the end of my understanding of Windows, so you'll need to wait for someone else to help 09:55
(btw, `dir <d:\>` is probably better written as `dir 'd:\'`, the <> produce a list, which is not always what you want/need) 09:56
yauhen i'm understanding how it works. works fine but i just need use correct environment encoding. i don't want changing whole system encoding for that purpose. 09:57
SmokeMachine is anyone else also having this problem? github.com/FCO/Red/runs/6369311220...focus=true 11:53
tellable6 2022-05-10T03:59:43Z #raku <melezhik> SmokeMachine an example of badge for test GH project is here - github.com/melezhik/rakudist-teddy.../README.md
hey SmokeMachine, you have a message: gist.github.com/c78c07d24c8744f27f...da851facd0
SmokeMachine .tell melezhik Thanks! Just added that to Red's README! 11:59
tellable6 SmokeMachine, I'll pass your message to melezhik
Geth ecosystem: f764e8dd1c | (Elizabeth Mattijsen)++ | META.list
Freeze Netstring

While we move it to the fez ecosystem
12:04
CIAvash SmokeMachine: `:` in `https%3A` is encoded in that version in REA, I think that's why it fails 12:13
lizmat: ↑ 12:14
lizmat argh.. did I screw up ? 12:15
CIAvash too much encoding 😀 colon in `https:` gets encoded as well, not just the name of the files 12:17
lizmat updated the META on the REA, a zef update should give you fixed URLs 12:20
CIAvash SmokeMachine: It should work now, lizmat++ 12:25
Geth ecosystem: b1196385fc | (Elizabeth Mattijsen)++ | META.list
Remove Toaster

It will continue to live in the REA
12:44
SmokeMachine thank you CIAvash and lizmat ! 13:33
somebody hi. this example doesn't work. examples.raku.org/categories/inter.../calc.html 14:56
returns '()'.
I don't have working example that had made today. But when I had used this example as 'unit module Calc;' then 'my grammar Arith { * }' and 'sub calc($input)', this example worked fine
tellable6 2022-04-18T19:54:14Z #raku <[Coke]> somebody stackoverflow.com/questions/271563...from-perl6
dutchie somebody: that example appears to use the deprecated `$()` where `$/.made` should be used now docs.raku.org/language/variables#T.../_variable 15:00
alternatively change `use v6;` to `use v6.c;` 15:03
somebody works. thanks 15:04
grondilu sometimes I hate programming. 16:54
I thought I was making progress on my protobuf library. 16:55
grondilu even though I had to write what I consider ugly code. Lots of arbitrary hash structures, if/then test on these structures, and `die` at pretty much every steps to check hash values. 16:56
I thought I had written the worst part of it. 16:57
grondilu and then I realize I have to implement the equivalent of lexical scopes. 16:57
which I will have to do with yet an other set of if/then/die and so on.
I'm sure it would be simpler with MOP, but I can't resolve myself to try that for some reason. 16:59
grondilu japhb: you there? 17:00
honestly I wish someone would write this library instead of me. Such a hassle to design. 17:01
grondilu All implementations of this library do code generation. I somehow try not to because I don't understand the MOP, but damn that makes it hard. I guess there is a reason they do code generation. 17:15
kaskal maybe it is a good chance to test RakuAST? 17:45
lizmat fwiw, I was thinking the same thing 17:47
japhb grondilu: I am now. What's up (I haven't backlogged in this channel) 17:52
?
grondilu: Protocol Buffers and their API were literally *designed* with code generation in mind. The experience of which is why one of the original protobuf authors went off and did Cap'n Proto. 17:53
grondilu yeah
I think it's doable without code generation but I'm getting discouraged 17:54
japhb Protocol Buffers are so badly statically designed, that's why I eventually said (even *with* MOP help) that it wasn't worth it to me to finish the work I was doing with samuraisam.
So ... I certainly understand the sentiment. 17:55
grondilu yet, raku is supposed to be great at generating code.
but the MOP is kind of non-beginner friendly, I think
japhb I mean, it is, but you have to realize: The protobuf people designed it in such a way that eventually java compilers couldn't even *compile* the code that protobuf generates. There was an emergency get-all-the-principle-engineers-together meeting to work around that one, let me tell you. 17:56
grondilu: Yeah, it takes some time to get any comfort with the MOP -- and I don't even use it all that often. 17:57
grondilu I've seen in your code that you used nqp. I don't want to have to do that :/ 17:58
japhb I will say that it is worth the time investment -- I find just being able to use it for *inspection* is pretty valuable for really deep debugging. And it makes automatic code generation way easier. :-)
Well part of that is stuff that didn't have a non-NQP API back then.
grondilu would you consider modernizing your code so I could re-use part of it, if not all? 17:59
japhb And as kaskal and lizmat were saying, this is one of those places where a lot of effort is being put into RakuAST to *have* a decent API for a lot of that stuff, rather than hacks or NQP delving.
grondilu yeah but I don't want to wait for RakuAST to be ready
who knows how long it could take 18:00
japhb grondilu: I would say yes if my time weren't very much spoken for right now by $day-job.
kaskal AFAIK a whole lot is ready in rakuAST right ?
tonyo why we're replacing macros with code generation boggles my mind 18:01
lizmat indeed.. I'd say code generation is pretty feasible atm, I already did the work to make sprintf formatting generate code
japhb grondilu: nine++ has been doing a ton of work on it recently. He's gotten to the point (as of last weekend, I think) that he's working on precomp for it.
Kaiepi code generation...?
lizmat rather than parsing the format over and over again
tonyo or, why go does, specifically
lizmat there are two aspects to RakuAST branch:
japhb tonyo: Difference between semantic macros and syntactic macros.
lizmat 1. creating an API to create code
2. use that API to build a new grammar to parse Raku code 18:02
the first part is largely done
and that's the part you'd need
grondilu "a new grammar to parse Raku code" you mean you're going to write a new raku grammar?
a new STD? 18:03
japhb tonyo: To be clear, RakuAST allows you to directly build the *structure* of the code, rather than the *strings* that would need to be parsed.
El_Che no matter the language, when I get the message "you need to generate code" I back away
japhb El_Che: What I said to tonyo. :-)
lizmat grondilu: a new grammar in the sense of a new Grammar class, which would support what the Raku grammar supports today 18:04
grondilu ok
lizmat grondilu: this is *not* about creating a new language, the farthest away from that
composability of this new grammar is the most important goal
so, there will no longer be a src/Perl6/World.nqp to keep state 18:05
grondilu look what I wrote to encode a protobuf : github.com/grondilu/protobuf-raku/...kumod#L157 18:06
I don't think I have ever been so disgusted by something I wrote
but right now, it's the only raku code I know of that can encode protobufs :/ 18:07
grondilu as I've said, I'm getting discouraged. Maybe I should wait for rakuAST indeed. 18:07
japhb grondilu: github.com/samuraisam/p6-pb/blob/m.../Writer.pm -- or are you working at a different level in the protobuf stack in your code? 18:08
grondilu oh I thought you weren't doing encoding 18:09
japhb Hah! That code is so old that #| hadn't been fixed yet
grondilu: github.com/samuraisam/p6-pb/tree/m.../PB/Binary is the binary R/W layer in the code I worked on 18:10
grondilu I'll look at it more 18:11
japhb: do you know about the conformance test program?
japhb (Yes, it contains nqp code for writing to the buffers -- the native-value-writing Raku API hadn't been created yet when I wrote that.) 18:12
grondilu looks at github.com/samuraisam/p6-pb/blob/m...official.t 18:13
japhb grondilu: We just used tests from Google's docs, plus some of our own.
We hadn't reached the stage of a full conformance suite. 18:14
*of using a
grondilu the conformance program might be the way to go, still. You can skip all the tests you want.
japhb Well, feel free to use what you like from our code and/or tests. 18:15
grondilu your code really is old. Not trying to be mean. 18:17
like you don't even write 'unit module', just 'module'. I think that alone will throw an exception nowadays, no? 18:18
I suppose since I have plenty of time, I could fork it and modernize it myself.
but then again I'm scared of the NQP stuff 18:20
Kaiepi uint would be more appropriate in some spots nowadays 18:22
lizmat clickbaits www.reddit.com/r/rakulang/comments...ence_2022/ # Raku Conference Poll 18:28
lizmat also clickbaits rakudoweekly.blog/2022/05/09/2022-19-docublast/ 18:29
grondilu you have no package method in your Action class? 18:31
grondilu was struggling to figure out how to deal with that 18:32
the name resolution thing is what discouraged me
japhb grondilu: I absolutely do not take offense at that code being called old. It's from before 6.c, so ... yeah, it's showing its age for sure. 18:38
grondilu do you see what I mean by name resolution and if you do, how did you deal with it? 18:41
(or how were you planning to) 18:42
grondilu goes to sleep 18:56
tonyo japhb: not sure i understand your response 19:07
tonyo .tell japhb i understand how macros work, referring mostly to the trend of code generation vs just using macros (whether it's syntactic or semantic). go's use of code generation, in practice, is abhorrent 20:29
tellable6 tonyo, I'll pass your message to japhb
ecocode___ is there some tool like `perldoc` for raku ? 21:01
MasterDuke there's a `rakudoc`, but i'm not 100% sure it's easy to get working right now. some of the doc infrastructure is in a bit of a mild upheaval 21:03
[Coke]: is probably the best person to ask 21:04
ecocode___ I installed raku with rakubrew, but I don't seem to have that executable 21:11
(rakudoc)
MasterDuke yeah, it's a separate thing, not part of rakudo 21:12
ecocode___ hmm ok 21:13
MasterDuke i don't remember how it's installed, rakubrew, zef, something else... 21:14
ecocode___ found this on stackoverflow: `zef install 'rakudoc:auth<github:Raku>'` 21:19
which ends in `No candidates found matching identity: rakudoc:auth<github:Raku>` 21:20
MasterDuke what about just `zef install rakudoc`? 21:21
ecocode___ lol, how could I not think about that ? 21:25
still, gets an error ... 21:26
www.irccloud.com/pastebin/seYDOetP/
forcing now ... 21:27
seems to do the job 21:28
thx
MasterDuke i think you can just follow the suggestion and override the tests and it will install and work for the most part, i don't remember what exactly is causing the test fails
ecocode___ yep, it works 21:29