🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
00:02 reportable6 left 00:04 reportable6 joined 00:24 jgaz left 00:29 bdju left, bdju joined 01:12 guifa left 01:19 xinming_ joined
japhb Is there any way to speed up parsing of code (test files, in this case) that use custom circumfix operators? 01:21
If it was library code, I'd probably not worry too much -- that's what precomp is for -- but for tests it slows down the edit-test cycle
01:22 xinming left 01:26 MasterDuke joined 01:28 monkey_ left 02:05 Manifest0 left, Manifest0 joined
Xliff Is there a way alias class attributes? 02:14
Something like "has $.a is rw is also<able>" 02:15
Currently, I'm going with a raw method like "method able is rw { Proxy.new: FETCH => -> $ { $!a }, STORE => -> $, \v { $!a = v }; }" 02:16
03:05 evalable6 left, linkable6 left 03:06 evalable6 joined 03:07 linkable6 joined 03:09 keutoi joined
keutoi Are channel logs available somewhere? 03:12
03:19 monkey_ joined 03:34 monkey_ left
raydiak Xliff: you could bind it 03:53
m: class C { has $.a is rw; has $.b is rw; submethod TWEAK () { $!a := $!b; } }; my $o = C.new; $o.b = 1; say $o.a; $o.a = 42; say $o.b;
camelia 1
raydiak you'd have to do a little more to support either name in the constructor I think
keutoi: we're kinda in a transitional period between logging solutions, but a temporary interface exists at logs.liz.nl/ 03:55
Xliff radiak: Hi! Nice thought, but this is for repr<CStruct> where you can't have extraneous members. Hence the method. 04:00
raydiak hi :) and I see... 04:01
maybe a FALLBACK?
m: class C { has $.a; method FALLBACK ($m) is raw { $!a if $m eq "b" } }; my $o = C.new; $o.b = 42; say $o.a 04:02
camelia 42
Xliff keutoi: colabti.org/irclogger/irclogger_logs/perl6
raydiak not sure if that's any better than your proxy tbh, or if it works on a CStruct, but just another thought
Xliff ^^ Historical
keutoi: Current - colabti.org/irclogger/irclogger_logs/raku 04:03
rakiak: LOL. I prefer the procy. I am very FALLBACK() adverse.
raydiak yeah, you mnight be stuck with the proxy. I'm out of tricks off the top of my head, unless you want to wrap the whole CStruct within something else 04:05
and just returning the attribute doesn't work with a CStruct? like the fallback example but with a normal method... 04:06
Xliff Hmmm... that's an option, but an expensive one and would require delegation.
raydiak m: class C { has $.a; method b is raw { $!a } }; my $o = C.new; $o.b = 42; say $o.a
camelia 42
Xliff Huh! Oh, I like that. 04:07
raydiak never tried it with a CStruct though
Xliff Should also be less expensive than the Proxy.
It should be fine, since it's a method.
raydiak note that perticular implementation doesn't enforce read-only, it makes the private attribute directly accessible from outside, for better or for worse 04:09
that's why $.a isn't rw in that example, but I could assign a value to .b anyway and it still ends up in .a 04:10
iow, this would actually be more correct: 04:11
m: class C { has $.a is rw; method b is raw { $.a } }; my $o = C.new; $o.b = 42; say $o.a
camelia 42
keutoi raydiak: Xliff: thank you for the links
raydiak m: class C { has $.a; method b is raw { $.a } }; my $o = C.new; $o.b = 42; say $o.a # fails as it should without `is rw` 04:12
camelia (Any)
raydiak uh, hmmm...that throws under 2021.06, but fails silently on master 04:13
Xliff radiak: That's a regression. Bug it.
bisectable: class C { has $.a; method b is raw { $.a } }; my $o = C.new; $o.b = 42; say $o.a 04:14
bisectable6 Xliff, Will bisect the whole range automagically because no endpoints were provided, hang tight
keutoi mykhal: So that was a bug? I came across it when using emacs to load a buffer line by line.
bisectable6 Xliff, Output on all releases: gist.github.com/d6a3e683e6672427a1...ad28da9e2f
Xliff, Bisecting by exit code (old=2021.06 new=d668d99). Old exit code: 1
Xliff, bisect log: gist.github.com/490302694a875b1fb3...b3d7ce7a4e
Xliff, (2021-06-26) github.com/rakudo/rakudo/commit/db...6e098d3987
Xliff, Bisecting by output (old=2018.10 new=2018.11) because on both starting points the exit code is 1
Xliff, bisect log: gist.github.com/fb02d9e1c78ea418c3...d0d1b54eae 04:15
Xliff, (2018-11-06) github.com/rakudo/rakudo/commit/e6...962b3f0e96
Xliff, Bisecting by output (old=2017.05 new=2017.06) because on both starting points the exit code is 1
Xliff, bisect log: gist.github.com/74385d0d350a27a262...8a97f63eb0
Xliff, (2017-05-26) github.com/rakudo/rakudo/commit/0c...f1a759afee
Xliff, Output on all releases and bisected commits: gist.github.com/0662a4b7e37afa6e5a...9a69255e25
raydiak Xliff: agreed
Xliff Funny, bisectable can't find it working on any of its tests 04:16
Out for a nap !!! 04:17
raydiak rest well o/
or do you mean bisectable?
it shows the lack of error in some of its output, but doesn't seem to be doing a good job of actually noticing it and bisecting 04:19
looks like probably github.com/rakudo/rakudo/commit/db...ef078a5d0e 04:21
04:34 evalable6 left, linkable6 left, linkable6 joined, evalable6 joined 04:40 gordonfish- is now known as gordonfish 05:38 jmcgnh joined
mykhal keutoi: really not sure what causes that misleading claim "Package 'B' already has a method 'b'" in your raku repl screenshot imgur.com/a/Pi17pLg 05:44
keutoi: at least i verified it does not depend on chosen names, happens for A, a; B, b; but also for ABC, def, GHI, jkl. :) 05:48
moon-child oh, wow, that is bizarre 05:52
06:02 reportable6 left 06:03 reportable6 joined
moon-child m: say 1 ** i 06:31
camelia 1+0i
moon-child m: say 1ⁱ
camelia 5===SORRY!5=== Error while compiling <tmp>
at <tmp>:1
------> 3say 17⏏5ⁱ
moon-child LITERALLY unusable
amazingly this works 06:34
m: say 2²⁺²
camelia 16
moon-child m: say 2⁸¯⁴
camelia 0.00000000023
pony I don't have those little numbers on my keyboard ;o
moon-child hmm, I don't think that's right 06:35
I guess it's interpreted as (2 ** 8) ** -4 ?
pony 2 ** 8 ** -4 06:36
m: 2 ** 8 ** -4
camelia WARNINGS for <tmp>:
Useless use of "**" in expression "2 ** 8 **" in sink context (line 1)
moon-child but ⁺ seemed to do the right thing...
another thing that would be cool: 06:37
m: my \n = 4; say 2ⁿ
camelia 5===SORRY!5=== Error while compiling <tmp>
at <tmp>:1
------> 3my \n = 4; say 27⏏5ⁿ
mykhal m: say <¯> eq <⁻> 06:51
camelia False
07:03 linkable6 left 07:04 linkable6 joined 07:45 Eddward_ left
Xliff m: my \ⁿ = 4; say 2ⁿ 08:05
camelia 5===SORRY!5=== Error while compiling <tmp>
at <tmp>:1
------> 3my \ⁿ = 4; say 27⏏5ⁿ
Xliff Huh
moon-child well, that part actually makes sense, because 08:06
m: my \ⁿ = 4; say 2**ⁿ
camelia 16
moon-child so it's just two consecutive tokens 08:07
I mean, I think it would be cool if it were supported, but it's technically a compat break
08:45 linkable6 left, evalable6 left 08:46 evalable6 joined 08:48 linkable6 joined
raydiak and for whatever reason, this doesn't work either 08:50
m: my \n = 4; sub postfix:<ⁿ> ($base) { $base ** n }; say 2ⁿ
camelia 5===SORRY!5=== Error while compiling <tmp>
at <tmp>:1
------> 3ostfix:<ⁿ> ($base) { $base ** n }; say 27⏏5ⁿ
raydiak even though this works:
my \n = 4; sub postfix:<n> ($base) { $base ** n }; say 2n 08:51
evalable6 16
Xliff radiak: I think that endpoint needs to be hardcoded into Raku as a proper identifier. 09:06
09:39 Guest77 joined 09:56 Sgeo left
raydiak maybe you know something I don't, but as I understand it that definitely should not be the case. ⁿ counts as a word character, and works as a term or a sub name. all kinds of other characters work with postfix:<>, including other word characters. this one behaves differently for whatever reason. I just don't honestly care enough to investigate further, was just something I happened to notice 09:59
10:00 squashable6 left 10:03 squashable6 joined
raydiak my guess would be there's probably something about the unicode category or other properties which causes it to fall through in the grammar 10:07
it even works as a prefix (if you add a space to prevent it from being parsed all as one identifier). just not postfix (whether with a space or without) 10:16
m: sub prefix:<ⁿ> ($a) { say "works" }; ⁿ 2
camelia works
raydiak m: sub infix:<ⁿ> ($a, $b) { say "works" }; 1 ⁿ 2
m: sub infix:<ⁿ> ($a, $b) { say "works" }; 1 ⁿ 2 10:17
camelia works
raydiak m: sub postfix:<ⁿ> ($a) { say "works" }; 1 ⁿ
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3sub postfix:<ⁿ> ($a) { say "works" }; 17⏏5 ⁿ
expecting any of:
infix stopper
statement end
raydiak m: sub postfix:<ⁿ> ($a) { say "works" }; 1ⁿ
camelia 5===SORRY!5=== Error while compiling <tmp>
at <tmp>:1
------> 3sub postfix:<ⁿ> ($a) { say "works" }; 17⏏5ⁿ
expecting any of:
raydiak and again if you use n instead of ⁿ, then postfix does work (without a space) 10:19
sub postfix:<n> ($a) { say "works" }; 1n
evalable6 works
raydiak m: sub postfix:<n> ($a) { say "works" }; 1 n
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3sub postfix:<n> ($a) { say "works" }; 17⏏5 n
expecting any of:
infix stopper
statement end
statement …
raydiak m: say uniprop "n"; say uniprop "ⁿ"; 10:22
camelia Ll
raydiak something about that difference is likely the cause 10:23
anyway, it doesn't bother me if someone has to write a slang to do that :) just a curiosity 10:25
11:03 linkable6 left 11:05 linkable6 joined
mykhal m: say "{ (2**1000).log2 }, { (2**1024).log2 }" 11:22
camelia 1000.0000000000001, Inf
11:23 lucerne left 11:24 lucerne joined 11:25 greyrat_ joined 11:26 greyrat left
pony m: say (2**1024).Str.chars 11:28
camelia 309
pony nite 11:29
11:48 holyghost joined 12:02 reportable6 left 12:05 reportable6 joined 12:20 lizmat_ joined 12:21 cognominal_ joined 12:22 TempIRCLogger left 12:23 lizmat left 12:25 cognominal left 12:27 lizmat_ left, lizmat joined 12:29 sono left 13:15 monkey_ joined 13:23 guifa joined 14:07 monkey_ left 14:09 guifa left 14:17 keutoi left 14:19 keutoi joined 14:37 abraxxa-home joined 14:44 keutoi left 14:58 dg left 15:00 guifa joined 15:02 monkey_ joined 15:41 keutoi joined 15:45 Eddward_ joined 15:53 keutoi left 16:05 algorev joined
algorev hello 16:06
weird question but
is there any chance raku _parses_ the received text when you use Socket::INET.recv? 16:07
i have this code:
my $sock = IO::Socket::INET.new(:host<google.com>, :port(80)); 16:08
$sock.print("GET" ~ " / HTTP/1.1\r\n\r\n");
.say for $sock.lines;
it fails the following way
<response from google> malformed utf-8 near bytes 67 65 f6 16:09
in block <unit> at .\gutenberg.raku line 3
so is it caused by the length of google's response? 16:10
or just an invalid character that's being printed?
what confuses me is that the error makes it sound like it's my code that doesn't parse
so i don't know
guifa malformed utf-8 means something was off in the byte stream as it tried to convert to a Str 16:11
algorev i see 16:12
so it's the conversion to Str in '.say'?
so the malformed character would be in the server's response? 16:13
guifa Likely. You might try reading it in binary mode and manually decoded as UTF-8, and then you can set a replacement character 16:14
algorev i see. thanks a lot!
16:14 algorev left
ugexe well at the very least thats going to forward you to https and you'll need IO::Socket::SSL for that 16:14
(not that that would cause your issue) 16:15
while (my $output = $sock.get) { say $output } # this works instead of $sock.lines although i would expect them to both work similarly 16:23
ah no it doesnt 16:24
my $sock = IO::Socket::INET.new(:encoding<utf8-c8>, :host<google.com>, :port(80)); $sock.print("GET" ~ " / HTTP/1.0\r\n\r\n"); say $_ for $sock.lines 16:26
evalable6 HTTP/1.0 200 OK
Date: Sun, 18 Jul 2021 16:26:21…
ugexe, Full output: gist.github.com/c51abccd0f91269990...ecd7d7627f
ugexe adding the :encoding that won't crap out on invalid utf8 allows it to run. note though that i also switched your example to http 1.0 since 1.1 will have chunked transfer encoding which you may not be expecting 16:27
16:53 abraxxa-home left 17:00 guifa left 17:17 monkey_ left 17:55 Sgeo joined 18:03 reportable6 left, reportable6 joined 18:06 Guest77 left 18:17 RakuIRCLogger left 18:18 jgaz joined 18:36 jgaz left 18:59 monkey_ joined 19:16 guifa joined 19:29 monkey_ left 19:35 Sgeo left, Xliff left 19:38 Sgeo joined 20:36 guifa left 20:40 vodkra left 20:46 vodkra joined 21:06 perlbot left, simcop2387 left 21:27 monkey_ joined 21:40 simcop2387 joined 21:41 perlbot joined 21:46 perlbot left, simcop2387 left 21:48 Geth left 21:49 lizmat left 21:50 lizmat joined 21:51 simcop2387 joined 21:52 perlbot joined 22:17 monkey_ left
japhb logs.liz.nl unresponsive for anyone else? 22:23
22:25 squashable6 left 22:27 squashable6 joined 22:35 squashable6 left 22:37 squashable6 joined 22:38 squashable6 left 22:39 squashable6 joined 23:27 phogg left, phogg joined
raydiak working here 23:49
though I don't see any updates for the past 5 or 6 hours on #raku, and it is quite sluggish to respond to requests (don't recall if it's slower than usual) 23:54