🦋 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.
SmokeMachine m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|%a), A.new(:@b) # <---------- Is this expected? Why is the array going inside the other array? 01:28
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: A.new(b => [1, 2, 3])
# got: A.new(b => [[1, 2, 3],])
gfldex m: my %a = :@b; dd %a; 01:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@b' is not declared
at <tmp>:1
------> 3my %a = :7⏏5@b; dd %a;
gfldex m: my @b = 1,2,3; my %a = :@b; dd %a;
camelia Hash %a = {:b($[1, 2, 3])}
gfldex m: my @b := 1,2,3; my %a = :@b; dd %a; 01:30
camelia Hash %a = {:b($(1, 2, 3))}
SmokeMachine I don't think that looks right.... 01:31
m: class A { has @.b }; my @b = 1,2,3; my %a = :@b; dd A.new(|%a).b.head; dd A.new(:@b).b.head 01:32
camelia Array @!b = $[1, 2, 3]
Int @!b = 1
gfldex m: class A { has @.b; method dd { dd @!b } }; my @b = 1,2,3; my %a = :@b; A.new(|%a).dd; 01:33
camelia Array @!b = [[1, 2, 3],]
gfldex m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|%a.pairs), A.new(:@b) 01:35
camelia Default constructor for 'A' only takes named arguments
in block <unit> at <tmp> line 1
gfldex m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|(%a.pairs)), A.new(:@b) 01:36
camelia Default constructor for 'A' only takes named arguments
in block <unit> at <tmp> line 1
SmokeMachine bisectable6: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|%a), A.new(:@b)
bisectable6 SmokeMachine, Will bisect the whole range automagically because no endpoints were provided, hang tight
SmokeMachine, Output on all releases: gist.github.com/b98f4d878cd494d1c4...e4b8cc4adc
SmokeMachine, Bisecting by output (old=2017.08 new=2017.09) because on both starting points the exit code is 1
SmokeMachine, bisect log: gist.github.com/9dd106486a5f0cba2a...461b6b98cc 01:37
SmokeMachine, (2017-08-25) github.com/rakudo/rakudo/commit/b6...9209e3d416
SmokeMachine, bisect log: gist.github.com/72bbd39d2a7bc5fb7a...b5a03d6ae5
SmokeMachine, bisect log: gist.github.com/9b1bd5b76cf59f932f...06e1e2c42d
SmokeMachine, Output on all releases and bisected commits: gist.github.com/d367b3009828a6ccca...52608b364e
gfldex goes to read roast on colonpair 01:38
SmokeMachine that was always like that?! 01:39
github.com/rakudo/rakudo/issues/4664 01:43
SmokeMachine Is that a bug to that just work that way? 01:47
[Coke] .
SmokeMachine Hi [Coke] ! if curious, I was asking about this: 01:50
m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|%a), A.new(:@b) # <---------- Is this expected? Why is the array going inside the other array?
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: A.new(b => [1, 2, 3])
# got: A.new(b => [[1, 2, 3],])
gfldex m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|(%a.pairs.head)), A.new(:@b) 01:54
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: A.new(b => [1, 2, 3])
# got: A.new(b => [[1, 2, 3],])
gfldex m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|Pair.new('b', @b)), A.new(:@b) 01:55
camelia ok 1 -
gfldex My guess is that Rakudo does rely on .pairs . 01:56
m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; dd %a.pairs;
camelia (:b($[1, 2, 3]),).Seq
SmokeMachine but .new(:@b) isn't a pair but an "named param", right? 01:58
m: class A { has @.b }; say A.new: :b[1,2,3]; A.new: "b" => [1,2,3] 01:59
camelia A.new(b => [1, 2, 3])
Default constructor for 'A' only takes named arguments
in block <unit> at <tmp> line 1
gfldex colon-pairs and Pairs are supposed to be equivalent. The only difference is that you can use colon-pairs as adverbs in operators - what is a grammar level thing. 02:12
SmokeMachine it doesn't seem to be related to the array being itemised 02:17
m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(:b[$@b]), A.new(:@b)
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: A.new(b => [1, 2, 3])
# got: A.new(b => [[1, 2, 3],])
SmokeMachine or does it?! 02:18
m: use Test; class A { has @.b }; my @b = 1,2,3; my $c = @b; is-deeply A.new(:b($c)), A.new(:@b); is-deeply A.new(:b($c<>)), A.new(:@b) 02:20
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: A.new(b => [1, 2, 3])
# got: A.new(b => [[1, 2, 3],])
ok 2 -
SmokeMachine it seems it doesn't work if the array is itemised and works if it isn't... 02:21
(but inside a hash it will alway be itemised...) 02:22
I think that makes sense to be that way... but how should one have an hash with the parameters (with an array between them) and make it work? 02:23
m: use Test; class A { has @.b }; my @b = 1,2,3; my %a = :b(|@b); is-deeply A.new(|%a), A.new(:@b) # should this split expand and make it work? 02:25
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: A.new(b => [1, 2, 3])
# got: A.new(b => [slip(1, 2, 3),])
SmokeMachine Should slip work? 👆 09:41
Skarsnik_ Sleep is always good 10:44
SmokeMachine Sorry, I haven't seen the issue was responded... 11:21
use Test; class A { has @.b }; my @b = 1,2,3; my %a = :@b; is-deeply A.new(|%a.Map), A.new(:@b)
evalable6 ok 1 -
lizmat clickbaits rakudoweekly.blog/2021/12/06/2021-...ing-is-on/ 12:56
one note of warning: reading all the blog posts is not going to be good for your productivity in the short run :-)
tbrowder hi, trying to work on comm module Pastebin::Gist to simply change .pm6 to .rakumod and get a rakudo error when testing. 13:29
i'll paste error here shortly 13:30
arg, standby, may be false alarm, hard to read zoffix code... 13:33
tbrowder the error appears to be from other modules using Pastbin::Gist, and the current version fails its own tests due to github changing the gist token format 15:47
Pastebin::Gist
sena_kun tbrowder, oh, it surely can be broken due to the change. 16:09
Xliff tio.run/##ZY/dSsNAEIXv8xSHUOyukClW...niYx0zz/AA
Oh, how I hate these long URLs.
Feel free to play. 16:10
tbrowder a little more debugging: my github gist token is current and uses the format which was changed in march or a bit later this year 16:27
i started new branch and then changed Gist.pm6 to Gist.rakumod 16:29
tbrowder i can run raku -Ilib t/*.t successfully 16:31
but, when i run zef test . i get: 16:32
www.irccloud.com/pastebin/isI4Tpje/ 16:33
i am using latest rakudo 2021.10
what stupid thing am i doing??
i have latest zef also 16:34
tonyo tbrowder: have you updated that file in the META? 16:35
tbrowder erg, probably not, thnx 16:36
tonyo: good fix, getting senile, thanks!! 16:38
tbrowder tonyo: how do we use fez for community modules? what user credentials? or do we have to adopt? 16:50
tonyo you can adopt but if you wait a couple of weeks the groups portion should be done being tested and i will update fez with the functionality
can't join or manage groups yet with it so it's kind of useless 16:51
tbrowder i don't want to adopt, but i can PR and merge it, thnx
tbrowder how are tests in xt used? Pastebin::Gist needs a test on the user's system to ensure his personal token works, so i want zef to test it locally but not on github. maybe that won't work in a global installation... 17:19
SmokeMachine lizmat: finally RedFactory seems to be working for general classes... I'm going to do a new release of that after work... 17:26
lizmat SmokeMachine++ 17:36
thundergnat Xliff: tio.run/##Zc7NCoJAFIbhvVfxFREaeqSI...n@75Pg1jj8 17:40
Xliff thundergnat++ 17:49
tbrowder fyi, i just ran my next advent article through Zoffix's advent hightlighter, using the --wrap and --multi options, and it's looking pretty good. 18:47
the --multi option requires one perl module 18:48
his module has been fixed to use the new github gist token format 18:49
Smylers Hi. In this code, why doesn't the 3rd s/// do anything? gist.github.com/Smylers/afd792f187...000e3a0e32 Thanks. 20:13
moritz_ looks like a bug to me 20:27
merryprog m: my $num = 11; say S/..<?after «$num»>/ZZ/ with "11!!" 20:37
camelia ZZ!!
merryprog m: my $num = 11; my $str = "11!!"; $str ~~ s/..<?after «$num»>/ZZ/; say $str
camelia ZZ!!
merryprog m: my $num = 11; my @str = ["11!!"]; @str[0] ~~ s/..<?after «$num»>/ZZ/; say @str[0] # or even 20:38
camelia ZZ!!
merryprog oh 20:41
m: my $num = 11; say S/..<?after «11»>/ZZ/ with "1111"
camelia 1111
merryprog There we go! 20:42
MasterDuke interesting, the second version didn't work at first either gist.github.com/Whateverable/ed39b...764ecdcbd1
merryprog oooo weird 20:43
to the bisectable6 we go
MasterDuke m: my $num = 11; say S/..<?after $num>/ZZ/ with "1111" # Smylers 20:46
camelia ZZ11
MasterDuke moritz_: should it still work with those «» there? 20:49
or should that be some sort of error/warning?
merryprog Maybe it was meant to be 20:50
m: say S/<?after ..>11/ZZ/ with "1111"
camelia 11ZZ
moritz_ MasterDuke: the « » mean word boundary, right? 20:52
merryprog oh, you're right
MasterDuke that's what it usually means, but maybe inside the <?after > they're just being interpreted as interpolating quotes
moritz_ but why would it be interpreted any different? 20:53
Smylers I was wanting them to mean word boundary. Specifically I want to overwrite exactly 2 characters, regardless of how long the number is, but only if the entire number matches. 20:54
Also, thank you both for looking into this.
moritz_ m: $_ = 42; s[\d+] = $/ == 42 ?? 23 !! $/; .say 20:55
camelia 23
moritz_ m: $_ = 18; s[\d+] = $/ == 42 ?? 23 !! $/; .say
camelia 18
moritz_ Smylers: ^^ a workaround for you
MasterDuke well, the ast for the « » version has a pair of `QAST::Regex(:rxtype(anchor) :subtype(lwb))`and `QAST::Regex(:rxtype(anchor) :subtype(rwb))` that the version without doesn't 20:56
so yeah, they're being interpreted correctly in that regard
moritz_ MasterDuke: I was aalso just checking the AST, but slower than you 20:56
MasterDuke that's the only difference 20:57
MasterDuke pipes the ast ouput into files and then looks at them with vimdiff
moritz_ and between the two anchors, it also says Nodelist [INTERPOLATE, lexical $x 0 0 0 0] (basically 20:57
does anybody know what these four 0s mean? 20:58
moritz_ (but they are there without the « » as well, so shouldn't make a difference) 20:58
MasterDuke i guess those are the args to INTERPOLATE? 20:59
merryprog better example:
m: my $num = 12; say S/..<?after «12»>/ZZ/ with " 123 12 3 "
camelia 123 ZZ 3
merryprog m: my $num = 12; say S/..<?after «$num»>/ZZ/ with " 123 12 3 "
camelia 123 12 3
moritz_ m: my $num = 12; say S/..<?after $num>/ZZ/ with " 123 12 3 " 21:02
camelia 123 12 3
merryprog ah, thanks
moritz_ the «» seem to be a red herring, variable interpolation doesn't seem to work in <?after>
MasterDuke m: my $num = 11; say S/..<?after $num>/ZZ/ with "1111" # but it does in this example, right? 21:04
camelia ZZ11
MasterDuke oh, wait 21:05
merryprog whoa this is weird 21:13
m: my $num = 12; say S/..<?after «$num»>/ZZ/ with "123 12 3" 21:14
camelia 123 12 3
merryprog m: my $num = 11; say S/..<?after «$num»>/ZZ/ with "113 11 3"
camelia 113 ZZ 3
tonyo m: my $num = 11; say S/<?after «$num»>../ZZ/ with "113 11 3" 21:23
camelia 113 11ZZ
tonyo is this what you were expecting merryprog ?
merryprog no 21:24
The one with num = 11 gives the correct substitution... the one with num = 12 doesn't.
Smylers What? It depends on the number?! 21:25
merryprog ... yeah 21:26
moritz_ I believe <?after> does some weird, internal string reversals to be able to match backwards 21:28
merryprog m: for 1..15 -> $num {say "$num -> " ~ (S/..<?after «$num»>/Z/ with "{$num}3 {$num} 3").contains('Z')}
camelia 1 -> True
2 -> False
3 -> True
4 -> False
5 -> False
6 -> False
7 -> False
8 -> False
9 -> False
10 -> False
11 -> False
12 -> False
13 -> False
14 -> False
15 -> False
merryprog oh wait, that can be better 21:29
moritz_ m: my $num = 21; $_ = 'foo 123 bar'; say S/<?after $num>/XX/'
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3= 'foo 123 bar'; say S/<?after $num>/XX/7⏏5'
expecting any of:
infix
infix stopper
postfix
statement end
moritz_ m: my $num = 21; $_ = 'foo 123 bar'; say S/<?after $num>/XX/ 21:30
camelia foo 12XX3 bar
moritz_ it finds 12 when you give it 21
merryprog maths
this is so janky, lol
I love it
moritz_ m: my $x = 'cba'; $_ = 'foo abc bar'; say S/<?after $x>/XX/
camelia foo abcXX bar
merryprog m: my $num = 21; say S/..<?after $num>/ZZ/ with " 123 12 3 " 21:31
camelia ZZ3 12 3
merryprog wow
m: my $num = 21; say S:g/..<?after $num>/ZZ/ with " 123 12 3 "
camelia ZZ3 ZZ 3
merryprog that is /so weird.
ahahaha, this even happens: 21:40
m: my $num = 12; say S:g/<?after $num>/!/ with "12 21"; say S:g/<?after 12>/!/ with "12 21"
camelia 12 21!
12! 21
merryprog So it's for some reason reversing it... when doing variable interpolation
moritz_ <?after> has to match a regex backwards from the current cursor position 21:44
implementing a whole backwards matcher would've been really quite much work and code duplication, so instead there is a clever trick: reverse both the string and the literals in the regex, and match forward to the end of the <?after> 21:45
merryprog sounds super plausible to me :)
moritz_ it just seems that when doing so, the implementors forget that you *also* need to reverse interpolated strings (or maybe didn't forget it, but didn't have the framework necessary to apply the reversal at run time) 21:46
merryprog nods
now we hope whoever wrote that is going to see this conservation and commit a fix so none of us have to make a ticket for it or find the offending code ourselves 21:47
Smylers Thanks. That actually makes sense. 21:52
gfldex TIL: When writing tests, don't use symetric strings. 21:53
japhb For extra points, don't use ASCII printable strings 21:55
merryprog For extra points, github.com/minimaxir/big-list-of-n...ty-strings
Skarsnik hm 22:25
m:class A{has uint8 $.a }; my $a = A.new(:a(185));say sprintf("%
02X", $a.a)
evalable6 (exit code 1) 04===SORRY!04=== Er…
Skarsnik, Full output: gist.github.com/4cc53f973871599174...c85b371115
Skarsnik class A{has uint8 $.a }; my $a = A.new(:a(185));say sprintf("%02X",$a.a)
evalable6 -47
Skarsnik This is an annoying but x)
*bug 22:26
m:my uint8 $a = 185;say sprintf("%02X", $a) 22:27
evalable6 B9
gfldex m: class A{has uint8 $.a }; my $a = A.new(:a(185)); say $a.a.WHAT; 22:28
camelia (Int)
gfldex m: class A{has uint8 $.a; method dd { dd $!a, $!a.WHAT } }; my $a = A.new(:a(185)); say $a.dd;
camelia -71
Nil
Int
gfldex m: class A{has uint8 $.a; method dd { dd $!a, $!a.WHAT } }; my $a = A.new(:a(185)); $a.dd; 22:29
camelia -71
Int
Skarsnik class A{has uint32 $.a }; my $a = A.new(:a(185));say sprintf("%02X",$a.a)
evalable6 B9
gfldex m: class A{has uint32 $.a; method dd { dd $!a, $!a.WHAT } }; my $a = A.new(:a(185)); $a.dd;
camelia 185
Int
Skarsnik look like the unsigned constraint is lost somewhere
gfldex indeed
Skarsnik I guess I can switch to uint16, but it was a byte value xD 22:30
gfldex Well, the constaint is only taken into account before binding the value to $!a. After that the type of the bound value counts.
Skarsnik m:class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say 22:31
sprintf("%02X", $a.a)
evalable6 (exit code 1) 04===SORRY!04===
Ar…
Skarsnik, Full output: gist.github.com/5750c54867f1e46ba5...b688ef9aea
Skarsnik class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say
sprintf("%02X", $a.a)
grmbl
m: class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say sprintf("%02X", $a.a) 22:32
camelia -47
Skarsnik I really don't get this one thou
gfldex 185 is bigger then 128 so when treated as a singed int8, it will be negative. 22:35
Int is int64 unless promoted to BigInt.
m: class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say sprintf("%02u", $a.a) 22:37
camelia negative value '-71' for %u in sprintf
Directive %u not applicable for value of type Int (-71) in format
'%02u'
in block <unit> at <tmp> line 1
gfldex m: class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say sprintf("%02d", $a.a)
camelia -71
gfldex There is no signed hex value for sprintf and friends. 22:38
Skarsnik yes, but there is not reason to fallback to signed int x)
gfldex It should complain indeed. 22:39
Skarsnik 185 fit in a uint8
gfldex m: class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say sprintf("%b", $a.a) 22:40
camelia -1000111 22:41
gfldex :D
That is supposed to be an unsigned int in binary.
It might just be that the sprintf-implementation predates unsinged native types. 22:42
Skarsnik m: class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say $a.a;
camelia -71
Skarsnik does not came from sprintf :)
gfldex sprintf should be able to get it right tho. It's sitting right on top of the VM, using plenty of nqp-magic. 22:43
Skarsnik m: class A is rw {has uint8 $.a }; my $a = A.new; $a.a = 185;say $a.a.REPR; 22:46
camelia P6opaque
Skarsnik REPR should not be P6opaque for a native 22:47
MasterDuke Skarsnik: fyi, nine++ is currently working on improving the uint support in moarvm/nqp/rakudo 22:47
gfldex m: class A{has uint32 $.a; method dd { dd $!a, $!a.REPR } }; my $a = A.new(:a(185)); $a.dd; 22:49
camelia 185
"P6opaque"
MasterDuke m: my uint8 $a = 3; say $a.WHAT
camelia (Int)
MasterDuke when you call a method on a native it gets autoboxed
gfldex WHAT is not a method. 22:50
Skarsnik :( the multi line reporting is still not fixed? (a block of instruction on multiple line, like multiple condition of a if). It's annoying to only have the error repport for the first line :( 22:52
japhb Skarsnik, gfldex: ++nine has been working on a thorough rethink of signedness at all levels of the stack. PRs aren't ready yet, but I'd say hold on a few days before overthinking this. (It's all known bugs, and it's being worked on.) 23:14
Skarsnik I probably already repported this like 4-5 years ago anyways ^^
moon-child japhb: a pre-increment well-deserved for some impressive and tedious work 23:19
:)
jgaz Is it just me, or is raku-beginner not on libra chat. Was it not ported from freenode? 23:24
moon-child #raku-beginners (with an s), I think? 23:25
hm, maybe not...
jgaz It's sans 's'. I just tried joining manually and it worked. There are people there. But I don't think it's a discoverable channel. 23:26
If you ask for a list of channels from the IRC server -- unless I just missed it -- you won't find it.
Let me know if I just need to get an eye exam... and another cup of coffee. :) 23:27
moon-child maybe it was not registered, and the list only shows registered channels?
jgaz Maybe? 23:28
jgaz I re-ran my search, it showed up the second time. 23:37
NM