🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
no-n is it possible to declare two classes that 'has' a variable of each others type? 06:32
guifa2 no-n: yes 07:06
it's easiest if they're in the same file
if you have classes A and B, first stub B: class B { … }
then define class A: class A { has B $.b } 07:07
then define class B: class B { has A $.a }
no-n ah! thanks 07:09
guifa2 if they're in different files..... you can sometimes pull off using interpolated types like class A { ::('B') $.b } but it's tough to get right 07:10
no-n heh, no, that's ok, they're same file :) 07:11
guifa2 Yeah, then stubbing is the way to go. I actually had to merge a few classes into one mega file because of that a few months ago 07:14
no-n *nod* 07:15
JJMerelo releasable6: status 07:38
releasable6 JJMerelo, Next release in ≈11 hours. 1 blocker. 85 out of 85 commits logged
Geth_ doc: 9c89efc471 | Antonio++ (committed using GitHub Web editor) | doc/Type/Junction.pod6
Fix typo, close #3516
linkable6 Link: docs.raku.org/type/Junction
DOC#3516 [closed]: github.com/Raku/doc/issues/3516 [docs] typo in method new of junction
releasable6 JJMerelo, Details: gist.github.com/d7dbd4fcc8bfb911cb...3e9b495ca5
Geth_ doc: 7fe5a62423 | (JJ Merelo)++ | 2 files
Eliminates boolean from dictionary, refs #3517
07:59
doc: d25ee46567 | (JJ Merelo)++ | doc/Type/Junction.pod6
Changes to Boolean in Junctions, refs #3517
linkable6 DOC#3517 [open]: github.com/Raku/doc/issues/3517 [docs][easy to resolve] Boolean should be capitalized
Link: docs.raku.org/type/Junction
JJMerelo m: my regex key {<? ^^ [#-]> \d+ }; say "#333" ~~ &key 09:35
camelia 5===SORRY!5===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> 3my regex key {<?7⏏5 ^^ [#-]> \d+ }; say "#333" ~~ &key
Unrecognized regex metacharacter ? (must be quoted to match literally)…
JJMerelo m: my regex key {<?^^ [#-]> \d+ }; say "#333" ~~ &key 09:36
camelia 5===SORRY!5===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> 3my regex key {<?7⏏5^^ [#-]> \d+ }; say "#333" ~~ &key
Unrecognized regex metacharacter ? (must be quoted to match literally)
JJMerelo m: my regex key {<?^ [#-]> \d+ }; say "#333" ~~ &key
camelia 5===SORRY!5===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> 3my regex key {<?7⏏5^ [#-]> \d+ }; say "#333" ~~ &key
Unrecognized regex metacharacter ? (must be quoted to match literally)
a…
JJMerelo m: my regex key { \d+ <?3$>}; say " #333" ~~ &key 09:37
camelia 5===SORRY!5===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> 3my regex key { \d+ <?7⏏053$>}; say " #333" ~~ &key
Malformed regex
at <tmp>:1
------> 3my regex key { \d+ <?7⏏053$>};…
JJMerelo m: my regex key {<?[^^]> \d+ }; say "333" ~~ &key 09:38
camelia Potential difficulties:
Repeated character (^) unexpectedly found in character class
at <tmp>:1
------> 3my regex key {<?7⏏5[^^]> \d+ }; say "333" ~~ &key
Nil
JJMerelo m: my regex key {<?[^]> \d+ }; say "333" ~~ &key
camelia Nil
JJMerelo So I have no idea what this "Anchors ^, ^^, $, and $$ are valid in lookarounds" means 09:43
thundergnat JJMerlo: I suspect that that is just ambiguously worded and means "Anchors ^, ^^, $, and $$ are valid in lookahead and lookbehind assertions" 10:50
m: say ("aabZ ccd eef" ~~ m:g/ \w+ <?[Z:$]> /).Str
camelia aab
thundergnat m: say ("aabZ ccd eef" ~~ m:g/ \w+ <before 'Z' | $> /).Str 10:51
camelia aab eef
thundergnat Yeah.
elcaro 12:02
Geth_ ecosystem/finanalyst-patch-4: 9e4d9b6191 | (Richard Hainsworth)++ (committed using GitHub Web editor) | META.list
Remove old module from Ecosystem

my `finanalyst/raku-pod-render` is a complete rewrite and upgrade of `finanalyst/pod-render`. Old pod-render is too close in name and could be confusing. Not aware that anyone uses old `pod-render`. So removing from the Ecosystem seems best.
12:53
ecosystem: finanalyst++ created pull request #518:
Remove old module from Ecosystem
gfldex lolibloggedalittle: gfldex.wordpress.com/2020/07/18/de...erplating/ 14:29
guifa2 weekly: gfldex.wordpress.com/2020/07/18/de...erplating/ 15:09
notable6 guifa2, Noted! (weekly)
guifa2 gfldex++ I have a hatred of boiler plate
lizmat
.oO( it can never be DRY enough )
15:11
timotimo is "without much afford" an idiom that i just never knew about? 15:19
lizmat he... no, that should be effort 15:22
or affordance I guess
probably not 15:23
guifa2 lizmat: hear hear! 15:32
guifa2 . o O ( actually, both of us really do seem to be making lots of utility modules to let people stay DRY )
lizmat well, tbh, my work on JSON::Fast was prompted by being annoyed with the slowness of interpreting data from Discogs 15:33
from-jsonning a 10K file is now down to 10msecs :-) 15:34
lizmat m: my %h; 16:01
say "foo" unless %h{"bar"}
say "bar";
camelia ( no output )
evalable6 bar
lizmat m: "my %h; say 'foo' unless %h\{'bar'}\nsay 'bar'".EVAL # a case where } at the end of the line is *not* a ; 16:03
camelia 5===SORRY!5=== Error while compiling /home/camelia/EVAL_0
Strange text after block (missing semicolon or comma?)
at /home/camelia/EVAL_0:2
------> 3my %h; say 'foo' unless %h{'bar'}7⏏5<EOL>
expecting any of:
infix
guifa2 do we not have it clear on the docs (I think we just say terminal } is a ; actually)? That } is part of the operator, rather than the block delimiter. 16:19
timotimo why is now the first time i hear that there's actually a "perlzwiebel" ("pearl onion") 16:42
timotimo en.wikipedia.org/wiki/Perl#Perl_on_IRC 16:50
JJMerelo m: say "First. Second" ~~ m:g/ <?after ^^ | "." \s+> <:Lu>\S+ / 16:54
camelia (「First.」 「Second」)
Geth_ doc: 0d8a0814de | (JJ Merelo)++ | doc/Language/regexes.pod6
Minor corrections according to rakudo/rakudo#3800
16:58
doc: 6eef3622ca | (JJ Merelo)++ | doc/Language/regexes.pod6
Clarifying "lookaround" assertions according ot answers in rakudo/rakudo#3800

Checking item in #2632
linkable6 Link: docs.raku.org/language/regexes
RAKUDO#3800 [open]: github.com/rakudo/rakudo/issues/3800 "Anchors valid in lookarounds": what does it mean. Plus: circumflex in lookaround does not work.
linkable6 DOC#2632 [open]: github.com/Raku/doc/issues/2632 [Hacktoberfest][RFE][big][docs][good first issue][help wanted][new][⚠ Top Priority ⚠] Checklist for 6.d
guifa2 timotimo: really? they're so yummy (especially pickled) 17:03
timotimo apparently also very expensive 17:05
kawaii Hello, I have the following snippet of code `$member.roles.map({$_.id }).Array ~~ @protected-roles` which is returning a `Seq`, which we then coerce into an array so that I can compare using ~~ to an existing array in memory. but keep getting this error message when using .cache or .Array www.irccloud.com/pastebin/j0VXeEEB/ 17:44
any ideas? :)
kawaii attempted to use `any($member.roles.map({ $_.id })) == any(@protected-roles)` as a workaround, but got the same result :) 17:47
timotimo you don't happen to have a golf of some kind? 19:03
kawaii timotimo: I... don't think so :( 19:13
timotimo can you do more thorough dumping around the code? 19:14
kawaii timotimo: github.com/myisha/p6-zoe-voteban/b...ban.p6#L34 19:16
anything look suspicious?
timotimo what's $member and $user like? 19:34
they aren't anything seq-like at all, yes?
does has-any-permissions go via self.roles or so? 19:35
btw junctions are already distributiing, so you can say any($member.roles).id == any(@protected-roles)
Zero_Dogg Can I type returned hashes from subs? Ie. a sub returns a hash with the keys success and value. Can I do a "returns" declaration that is more specific than "returns Hash" and have raku know more about what it is? Or should that maybe then be its own class instead?
timotimo you can 19:36
that'll be using the role/type parameter syntax like Hash[blah, blubb]
gotta go for a little bit 19:38
Zero_Dogg timotimo: could you point me to where in the docs I can read about that syntax? That was new to me
timotimo docs.raku.org/type/Hash#method_keyof - here's examples of the other syntax where you give a type for the key (or the values) for a "my %blah" declaration 19:40
Zero_Dogg timotimo: ty
timotimo aha
docs.raku.org/language/hashmap
this is a better place to look i bet!
"non-string keys" is one interesting section of that document 19:41
hum, no, that also only shows the "my"-related syntax
docs.raku.org/type/Associative - not really the easiest document to read for a beginner i guess? 19:42
maybe this could be turned into a docs issue on the tracker?
Zero_Dogg probably, but I need to find out how to declare what I want before I can formulate an issue :) 19:43
timotimo m: sub test(--> Int %{Int}) { return my Int %test{Int} }; dd test() 19:46
camelia 5===SORRY!5===
Shape declaration is not yet implemented; please use whitespace if you meant something else
at <tmp>:1
------> 3sub test(--> Int %7⏏5{Int}) { return my Int %test{Int} }; dd
Malformed return value (return constraints o…
timotimo m: sub test(--> Hash[Int, Int]) { return my Int %test{Int} }; test() 19:47
camelia ( no output )
timotimo m: sub test(--> Hash[Int, Int]) { return my Int %test{Int} }; dd test()
camelia Hash[Int,Int] %test = (my Int %{Int})
Zero_Dogg nod, but that won't let me declare, say, this method returns a hash with key "success" is Bool, and key "value" is Str. 19:48
timotimo ah, in that case you will want to use a class of your own 20:13
Zero_Dogg right, thanks :) 20:15
Geth_ ecosystem: gfldex++ created pull request #519:
I renamed the repo on github for META6::bin.
20:43
Petr37 Nice day/night to all )) 20:56
codesections I have encountered some surprising (to me) behavior – can anyone tell me if this is intended behavior? Here's the situation: in a file named `my-script.raku`, the following content: 21:46
use lib '.';
use MyMod;
say "Hi from my script";
evalable6 Hi from my script
codesections and then in `MyMod.rakumod`
unit module MyMod;
sub my-sub() { say "Hi from my-sub"};
say "Hi from MyMod";
evalable6 Hi from MyMod
codesections I would expect that to print "hi from my script", make `my-sub` available in `my-script`'s namespace, and *not* print "hi from MyMod" 21:47
Instead, it does print "Hi from MyMod". So I guess the mainline of each used module is run, even without invoking a single function from that module? 21:48
And the same seems to be true with `require` and `need`, right?
(It's not such an issue with `say`, but it's much more of one with `run <rm -rf>`, which seems like it'd work just the same. And, yeah, I know I ought to trust my dependencies *anyway*, but I didn't realize that amount of code would be executed without me explicitly calling any methods/subs. 21:51
(Unless I'm just very confused – always a distinct possibility!) 21:52
jnthn codesections: Yes, the mainline is run on module load, which can be used to do bits of initialization. Even were it not, folks could still write a custom EXPORT sub to do whatever they wish on symbol import, or an INIT phaser. 21:58
codesections jnthn: Interesting and good to know. I guess I need to be *especially* vigilant in auditing my dependencies! 21:59
And there's no way of bringing a module's symbols into my namespace without running their mainline code? 22:00
jnthn No, and as noted, you'd still not win much peace of mind anyway, 'cus an INIT phaser runs at module load time. And anyway, if you installed the module it already had change to run code at compile time, 'cus meta-programming depends on that. 22:08
codesections fair enough. Thanks – I could easily have spent a good deal of time thinking that I just wasn't figuring it out.
timotimo okay so i realize what i really should have made a long time ago is a "seq already in use" analyzer based on, like, the debugserver or something 22:31
is there a backreference to the Seq object from the iterator (or whatever) that has been pulling items from it? 22:32
if there's something like that, a heap dump could give you what you need to know
jnthn No, only Seq -> Iterator 22:33
timotimo otherwise the debugger will have to have a breakpoint everywhere that may be relevant, and track involved objects and store their stack traces and such
ah, seq -> iterator points at the iterator that the seq will pull from when it is asked to spit out its values?
m: Seq.new-from-list(1, 2, 3).map(*+1).&dd 22:34
camelia No such method 'new-from-list' for invocant of type 'Seq'
in block <unit> at <tmp> line 1
jnthn Yes
timotimo ah, from-list is only on Supply 22:35
timotimo m: my $s = (1, 2, 3).Seq; .say for $s; .say for $s.map(*+1); 22:35
camelia (1 2 3)
2
3
4
timotimo m: my $s = (1, 2, 3).Seq; .say for $s.map(* / 2); .say for $s.map(*+1);
camelia 0.5
The iterator of this Seq is already in use/consumed by another Seq
(you might solve this by adding .cache on usages of the Seq, or
by assigning the Seq into an array)
in block <unit> at <tmp> line 1

1
1.5
timotimo ok so this is the situation i guess? 22:36
maybe the only breakpoint the debugger would need is actually the "iterator" method of Seq?
perhaps this is even easy enough to just build with a module
and monkey-patch Seq
how do i replace the iterator method in Seq using augment? :o 22:40
jnthn Just .wrap it instead? 22:43
timotimo ah, right
timotimo annoyingly, Seq's iterator method is apparently used inside of call_with_capture or something 23:09
a simple recursion check doesn't seem to be enough 23:11
timotimo No such method 'push-all' for invocant of type 'ForeignCode' 23:16
incredible :)
holyghost fuck it, doubly defined obj files through bison in my m68k-coff gcc build
oh well
timotimo kawaii: you still there? 23:28
holyghost I have an assembler though, so maybe I'm going to port slib from ~gandalf 23:29
kawaii timotimo: yep! 23:32
timotimo gist.github.com/timo/9878a562fe9b8...11e7f74310 <- kawaii check this 23:33
it'd be better if it showed "map" in each instance, too 23:34
maybe all i need is the right offset 23:35
kawaii: i updated the gist with better code 23:37
kawaii 🤔 23:40
timotimo you had a "sequence was already consumed" problem, right?
kawaii Yes 23:41
Sorry brain is afk 23:42
timotimo the code in that gist will give you two backtraces instead of one
timotimo added one more piece of information that could perhaps be helpful 23:45
hm. if it would also mark where every Seq is created, that could also be helpful 23:49
also expensive and more typing work and i'm tired :) 23:50
but do tell me how it goes 23:52
feel free to pack the wrap call up in a sub somewhere and call it just before the code you're experiencing the problem with 23:53
also, you can use the return value of wrap to unwrap again
kawaii I'll get some coffee and figure out how to use it in an hour or so, thanks timotimo :)
timotimo oh, easy. put it anywhere where it gets run before your problem happens, and presto! 23:54