🦋 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. |
|||
00:04
rbt left,
rbt joined
00:08
reportable6 left
00:09
reportable6 joined
00:41
monkey_ left
|
|||
Xliff | m: my ($a, $b, $c, $d) = 0 xx 4; for $a, $b, $c, $d -> $_ is raw { say .VAR.name } | 00:44 | |
camelia | $a $b $c $d |
||
01:04
frost joined
01:14
razetime joined
01:44
rbt left,
rbt joined
01:49
djerius left
01:50
melezhik joined
|
|||
melezhik | .tell lizmat Whateverable build fails on SparkyCI - sparrowhub.io:2222/report/124 | 01:50 | |
^^ AlexDaniel | |||
HTH | |||
01:51
djerius joined
02:00
melezhik left
02:07
zacts joined
02:14
londoed_ left,
londoed_ joined
02:27
Nick12 joined
|
|||
Nick12 | What have people tried to make rakudo startup/execution faster? I absolutely love the power of the language but it's a barrier for me to adopt this over perl due to performance. For example: | 02:39 | |
raku -e 'print $_ for 1..1000000;' > /dev/null 1.66s user 0.03s system 104% cpu 1.617 total | |||
perl -e 'print $_ for 1..1000000;' > /dev/null 0.25s user 0.00s system 98% cpu 0.254 total | |||
Rakudo v2022.02 installed on macOS 12.2.1 with homebrew | |||
perl v5.34.0 on the same system, also installed with homebrew | |||
japhb | Nick12: In that *particular* case you may be running up against Perl doing no output encoding, but Raku using UTF-8 encoding by default. | 02:43 | |
But rather than microbenchmarks, I'd say it's more valuable to look at the performance difference for whatever it is you're *actually* trying to do. | 02:44 | ||
(Having written quite a few microbenchmarks, I can say that it is very easy to wildly change relative performance with minor changes.) | 02:45 | ||
Oh, also it matters for MacOS if you're on an Intel or ARM processor -- the latter does not yet have JIT support in Rakudo. | 02:46 | ||
Nick12 | Sure. I agree a single test case isn't sufficient to prove it's slower. Most big applications I default to using something like c++ and opt for scripting when I'm just trying to get something specific done really quickly and typically is focused on processing text (perl one liners? ooh 8) lol). I've perceived a slower response time using rakudo | 02:56 | |
which is a bit frustrating, and I know that's vague. It probably takes playing around with it a bit more and perhaps not entirely switching from perl to raku if I'm looking for something really snappy. The potential of saving minutes writing a raku script might dwarf the milliseconds to seconds of extra time spent executing one haha. | |||
FWIW I have an intel processor | 02:57 | ||
02:59
rbt left
03:05
zacts left
03:10
rbt joined
03:16
Guest35 left
03:33
guifa joined
|
|||
japhb | Yeah, generally perl will be faster for pure sed/awk-like tasks, as that is what it was optimized for. Rakudo will be faster for heavy OO and many of the numeric bits that Perl doesn't support out of the box (big integers, rational numbers, and complex numbers, for example). And as you note, rather often Raku has more general whipupitude and developer efficiency. | 03:34 | |
Also, very few interpreters beat perl on startup time. It's wicked fast at that. Rakudo does a lot more at startup than perl does, and it costs a few dozen milliseconds to do all of that. | 03:36 | ||
04:01
zacts joined
04:20
rbt left,
rbt joined,
Nick12 left
05:00
zacts left,
grondilu joined
05:20
rbt left,
rbt joined
05:25
rbt left
05:26
rbt joined
05:41
rbt left
05:51
rbt joined
|
|||
grondilu | on docs.raku.org/language/operators#O...precedence the table seems to list operator precedence levels alphabetically, not from actual precedence levels. | 05:54 | |
a quick search points to raku.finanalyst.org/language/operators.html | 05:57 | ||
where the table makes much more sense. | |||
06:11
rbt left
06:12
rbt joined
|
|||
grondilu | unrelated: | 06:15 | |
m: say class :: does Numeric { method Int { 13 } }.new div 7; CATCH { default { say "huh?" } } | |||
camelia | huh? | ||
grondilu | which method do I need to implement the Numeric role? | 06:16 | |
m: say class :: does Numeric { method Bridge { 13 } }.new div 7; CATCH { default { say "huh?" } } | |||
camelia | huh? | ||
grondilu | m: say class :: does Numeric { method Numeric { 13 } }.new div 7; CATCH { default { say "huh?" } } | ||
camelia | ===SORRY!=== Error while compiling <tmp> Cannot have a multi candidate for 'Numeric' when an only method is also in the package '<anon|1>' at <tmp>:1 |
||
grondilu | m: say class :: does Numeric { method Real { 13 } }.new div 7; CATCH { default { say "huh?" } } | 06:17 | |
camelia | huh? | ||
Voldenet | that table on operator_precedence seems to be sorted in some weird way | 06:25 | |
It is correct in source though github.com/Raku/doc/blob/master/do...s.pod6#L34 | |||
grondilu | then it's the conversion to html that is wrong. | 06:28 | |
Voldenet | …the html conversion is also correct :) | 06:31 | |
it's some fancy script that sorts the table | |||
06:33
abraxxa joined
06:37
abraxxa left
06:38
abraxxa joined
|
|||
Voldenet | regarding the "Numeric" role, operators are not part of the role | 06:46 | |
m: class X does Numeric is Int { method Int { 13 } }; multi infix:<div>(X:D $a, Int:D $b) { $a.Int div $b }; say X.new div 7 | 06:47 | ||
camelia | 1 | ||
Voldenet | m: say class :: does Numeric is Int { }.new(13) div 7 | 06:48 | |
camelia | 1 | ||
grondilu | oh ok, so with a straight-up inheritance to Int. | 06:49 | |
then I guess I don't even need Numeric | |||
m: say class :: is Int { method Int { 13 } }.new div 7; CATCH { default { say "huh?" } } | |||
camelia | 0 | ||
grondilu | m: say class :: does Numeric is Int { method Int { 13 } }.new div 7; CATCH { default { say "huh?" } } | 06:50 | |
camelia | 0 | ||
grondilu | not what I want | 06:51 | |
Voldenet | m: multi infix:<div>(Numeric:D $a, Int:D $b) { $a.Int div $b }; say class :: does Numeric { method Int { 13 } }.new div 7 | ||
camelia | 1 | ||
grondilu | I really don't want to have to redefine the operator myself. | 06:52 | |
06:53
Sgeo left
06:59
Voldenet left
07:03
Voldenet joined
07:10
rbt left
07:32
rbt joined
07:37
rbt left
07:38
rbt joined
|
|||
guifa | o/ | 07:50 | |
08:36
lichtkind_ joined
08:42
mexen left
08:48
rbt left
|
|||
AlexDaniel | melezhik18: I haven't tried installing it that way for a long time, so that's kinda expected. Pull requests are welcome | 09:20 | |
09:48
linkable6 left,
evalable6 left
09:49
evalable6 joined
09:50
linkable6 joined
10:09
rbt joined
10:24
rbt left,
rbt joined
|
|||
grondilu | isn't there a flag for `prompt` to suppress echo? | 10:31 | |
I mean what is the correct way to prompt for a password then? | 10:32 | ||
Nemokosch | hmmm | 10:34 | |
gfldex | grondilu: see github.com/rakudo/rakudo/blob/mast...s.pm6#L146 | 10:37 | |
echo is a property of the terminal and Raku doesn't know those exist | 10:40 | ||
raku.land/github:titsuki/Terminal::Readsecret | 10:41 | ||
this module does | |||
Voldenet | > sub without-echo(&fn) { LEAVE { run("stty", "echo") }; run("stty", "-echo"); fn() }; say without-echo({ prompt("password: ") }) | 10:42 | |
grondilu | I guess I can also call the shell : | 10:43 | |
say "password was {.out.slurp}" given shell q[read -s -p "password?"; echo $REPLY], :out | |||
evalable6 | password was ♥🦋 ꒛㎲₊⼦🂴⧿⌟ⓜ≹℻ 😦⦀🌵 🖰㌲⎢➸ 🐍💔 🗭𐅹⮟⿁ ⡍㍷⽐ |
||
grondilu | lol that's fun | ||
Voldenet | but shell implies bash | 10:44 | |
sh doesn't do read -s | |||
grondilu | I mean look at that beautiful unicode string | ||
gfldex | shell implies not-Windows | ||
Voldenet | touche | ||
grondilu | I don't mind excluding Windows users lol | 10:45 | |
Voldenet | windows-also solution sounds difficult to maintain on your own | ||
gfldex | It would make any coporate password policy very happy indeed. | ||
Voldenet | regarding corporate password policies, I've seen things you people wouldn't believe :D | ||
gfldex | I got a login for a software that controls SIM cards. 8 chars max for the PW. | 10:46 | |
grondilu thinks about the famous Sony playstation hack | |||
gfldex | Dont't use SMS for two-factory. | ||
s/y// | |||
Voldenet | sadly some services only have sms or nothing, sms is still better than nothing | 10:53 | |
grondilu | Voldenet: looking at your solution again, it looks fine actually | ||
Voldenet | well, stty is relatively portable too | 10:54 | |
grondilu | quite a smart use of LEAVE too | 10:56 | |
grondilu ended up using that solution | 10:59 | ||
what about checking input by prompting password twice and dying if the inputs differ? How to make sure echo is restored then? Since the LEAVE will not be executed. | 11:11 | ||
Voldenet | hmm? | 11:14 | |
grondilu | well it's common to ask for a password twice to check for input mistakes. | 11:15 | |
then if there is indeed a mistake I would raise an exception, but then the LEAVE will not be executed, would it? | |||
Voldenet | it would | 11:17 | |
grondilu | { CATCH { default { say "oops" }; LEAVE say "done"; die "aaaahh"; } }() | ||
Voldenet | m: { CATCH { default { say "oops" } }; LEAVE say "done"; die "aaaahh"; } | 11:19 | |
camelia | oops done |
||
grondilu | ok great | 11:21 | |
Voldenet | either way: | ||
sub without-echo(&fn) { LEAVE { run("stty", "echo") }; run("stty", "-echo"); fn() }; sub get-new-pass { without-echo(sub { loop { my $pass = prompt("password: "); return $pass if $pass eq prompt("\nrepeat password: "); say "\npasswords mismatch" } }) }; say get-new-pass; | |||
grondilu | I don't need a dedicated `without-echo` function but yeah, that's the idea. | 11:23 | |
m: { LEAVE run <echo bye>; say hi; } # testing shorter syntax | 11:24 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: hi used at line 1 |
||
grondilu | m: { LEAVE run <echo bye>; say "hi"; } # testing shorter syntax | ||
camelia | hi | ||
grondilu | hum | ||
11:24
discord-raku-bot left,
discord-raku-bot joined
|
|||
Voldenet | it will work if you test it on real env | 11:24 | |
grondilu | indeed | 11:25 | |
the run command is really powerful, especially now that it handles binary input/output. | |||
Voldenet | m: say $*OUT.native-descriptor | 11:26 | |
camelia | 1 | ||
Voldenet | that's most puzzling | 11:27 | |
m: say $*OUT | |||
camelia | IO::Handle<IO::Special.new("<STDOUT>")>(opened) | ||
11:28
xinming left,
xinming joined
11:45
abraxxa left
11:49
Altai-man left
12:06
zacts joined
12:14
melezhik joined
|
|||
melezhik | . | 12:14 | |
12:16
dogbert11 joined
12:17
dogbert17 left,
melezhik left
12:20
razetime left
12:29
rbt left,
rbt joined
12:30
dogbert17 joined
12:32
dogbert11 left
12:33
razetime joined
12:34
melezhik joined
12:37
melezhik left
12:44
sena_kun joined
12:51
mexen joined
12:58
dogbert11 joined,
dogbert17 left
13:09
TempIRCLogger joined
13:10
rbt left,
rbt joined
|
|||
[Coke] | As someone who uses windows raku for $dayjob, if there's a raku core solution that works (assuming this is going into the ecosystem), I'd prefer you used the core solution. | 13:28 | |
Voldenet | no dependencies is the best dependency | 13:39 | |
13:47
dogbert11 left,
dogbert17 joined
13:59
zacts left
14:04
Guest35 joined
14:11
Sgeo joined
14:18
dogbert17 left
14:21
dogbert17 joined
|
|||
[Coke] | mm! | 14:22 | |
Xliff | Still having problems with nested braces. This time trying to parse out methods from a class definition. | 14:23 | |
Can someone tell me what I'm missing? | |||
gist.github.com/Xliff/e2a51378257a...13c6369a8a | |||
14:30
rbt left,
rbt joined
14:44
frost left
|
|||
grondilu | [Coke]: do you use WSL? | 15:08 | |
15:08
rbt left
|
|||
El_Che | [WSL]: do you use Coke? | 15:12 | |
dunno, it's all a waze | |||
15:16
[Coke]_ joined
15:17
sena_kun left
15:18
[Coke] left,
sena_kun joined
15:28
razetime left
15:38
razetime joined
|
|||
[Coke]_ | I do not use WSL, no | 15:40 | |
15:40
[Coke]_ is now known as [Coke]
16:15
rbt joined
16:29
wingfold joined
16:36
rbt left,
rbt joined
16:44
wingfold left
|
|||
grondilu | how can I get JSON::RPC::Client to send an actual {} as parameter instead of 'null'? | 16:45 | |
16:45
razetime left
|
|||
grondilu | I have an rpc server which accepts {} as params but not null, and I think JSON::RPC::Client sends null. $server.method({}) works the same as $server.method() and fails. | 16:46 | |
17:01
rbt left,
rbt joined
|
|||
gfldex | grondilu: what happens when you send `Hash.new` ? | 17:24 | |
grondilu | same result | 17:28 | |
apparently the lib relies on add_fallback | |||
m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo({}) | |||
camelia | foo called with [] | ||
grondilu | but this mechanism does not accept and empty hash as a positional parameter? | 17:29 | |
m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo("hello") | |||
camelia | foo called with ["hello"] | ||
grondilu | see what I mean? | ||
m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo | |||
camelia | foo called with [] | ||
grondilu | m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo([]) | 17:30 | |
camelia | foo called with [] | ||
grondilu | neither an empty array? | ||
m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo(["hey"]) | |||
camelia | foo called with ["hey"] | ||
grondilu | looks like a bug to me | ||
oh wait | 17:31 | ||
m: sub (*@params) { @params }([]).say | 17:32 | ||
camelia | [] | ||
grondilu | m: sub (*@params) { @params }().say | ||
camelia | [] | ||
grondilu | ah | ||
grondilu tries to remember how this *@ thing is called. Slurpy parameters? | 17:33 | ||
m: sub (*@params) { @params }([].item).say | 17:34 | ||
camelia | [[]] | ||
grondilu | ah ah | ||
damn I was hoping that would work but the rpc call still fails | 17:35 | ||
m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo([].iteum) | 17:37 | ||
camelia | No such method 'iteum' for invocant of type 'Array'. Did you mean 'item'? in block <unit> at <tmp> line 1 |
||
grondilu | m: class { BEGIN { $?PACKAGE.HOW.add_fallback( $?PACKAGE, sub (|) { True }, -> $obj, $name { method (*@params, *%params) { say "$name called with {@params.raku}"; } } ) } }.new.foo([].item) | ||
camelia | foo called with [[],] | ||
17:46
rbt left,
rbt joined
18:16
rir joined
18:29
guifa left,
rir left
18:43
rypervenche left
18:53
grondilu left
19:37
rbt left,
rbt joined
19:47
rbt left,
rbt joined,
nebuchadnezzar left
19:48
nebuchadnezzar joined
20:46
rypervenche joined
21:11
saint- joined
21:22
rbt left,
rbt joined
21:31
lichtkind_ left
|
|||
saint- | Hi, I was wondering what was wrong with trying to use this grammar to parse into just separate lines? www.toptal.com/developers/hastebin...orefon.lua | 22:15 | |
22:31
linkable6 left,
evalable6 left
22:32
linkable6 joined
22:33
evalable6 joined
|
|||
Voldenet | m: grammar Lit { token TOP { ^ <lines>+ $ }; token lines { .*? '\n' };}; Lit.parse("ab\nc\nde\n").say | 23:02 | |
camelia | Nil | ||
Voldenet | m: grammar Lit { token TOP { ^ <lines>+ $ }; token lines { .*? "\n" };}; Lit.parse("ab\nc\nde\n").say | 23:04 | |
camelia | 「ab c de 」 lines => 「ab 」 lines => 「c 」 lines => 「de 」 |
||
Voldenet | the '\n' works, but probably not in the way you want | 23:06 | |
m: grammar Lit { token TOP { ^ <lines>+ $ }; token lines { .*? '\n' };}; Lit.parse("ab\\nc\\nde\\n").say | |||
camelia | 「ab\nc\nde\n」 lines => 「ab\n」 lines => 「c\n」 lines => 「de\n」 |
||
23:33
evalable6 left,
linkable6 left,
evalable6 joined
23:35
linkable6 joined
|