🦋 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.
Geth Raku-Steering-Council/main: 26a1b2ec63 | (Geoffrey Broadwell)++ | minutes/20220416.md
Add RSC meeting minutes for 2022-04-16
00:17
melezhik Hi! I have written a small update on SparkyCI progress - www.reddit.com/r/rakulang/comments...ci_update/ 02:02
El_Che weekly: Hi! I have written a small update on SparkyCI progress - www.reddit.com/r/rakulang/comments...ci_update/ 07:00
notable6 El_Che, Noted! (weekly)
lizmat weekly: vrurg.github.io/2022/04/18/will-complain-trait 08:59
notable6 lizmat, Noted! (weekly)
grondilu what's the correct way to test whether a string is parsed by a grammar? `so $grammar.parse($str)` or `$str ~~ /^<$grammar::TOP>$/` ? 09:03
or something else?
$str ~~ $grammar would make sense but I don't think that works 09:04
m: say "foo' ~~ grammar { rule TOP { foo } }
camelia ===SORRY!===
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> ay "foo' ~~ grammar { rule TOP { foo } }⏏<EOL>
Other potential difficulties:
Useles…
lizmat I'm not sure I understand the word "test" in that question
grondilu check, if you will 09:05
lizmat $grammar.parse is just a method accepting a Str
grondilu .parse it is then
lizmat feels like a rubber duck, but that's ok :-) 09:06
grondilu I thought it might be overkill or something
gfldex m: say 'foo' ~~ grammar { rule TOP { foo } }.new;
camelia 「」
gfldex I somehow feel this should work. 09:07
m: grammar { rule TOP { foo } }.new.HOW.say;
camelia Perl6::Metamodel::GrammarHOW.new
gfldex m: grammar { rule TOP { foo } }.new.WHAT.say; 09:08
camelia (<anon|1>)
p6steve drakonis: have you seen Math::Matrix - An interface to libgsl, the Gnu Scientific Library - Vectors and Matrices? 12:33
drakonis: and the Math::Libgsl:: family - search libgsl in the raku.land search box - there are 27 of these 12:35
drakonis: fwiw I am working on raku Dan and Dan::Pandas which is a data analytics library for raku github.com/p6steve/raku-Dan 12:37
drakonis: and then Dan::Polars is my follow on goal 12:41
El_Che For the comma devs, heads up that comma community is broken on IntelliJ IDEA 2022.1 (Ultimate Edition), Build #IU-221.5080.210, built on April 12, 2022 12:50
Nemokosch do you know what zef uses to fetch raw files from github? 13:05
lizmat the first thing that works ? 13:06
grondilu m: role A { multi method new { samewith "foo" }; }; class B does A { multi method new(Str $s) { say $s } }.new 13:52
camelia Default constructor for 'A' only takes named arguments
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
grondilu can't samewith refer to a method from a derived class?
m: role A { multi method talk { samewith "hi" }; }; class B does A { multi method talk(Str $s) { say $s } }.new.talk 13:53
camelia hi
grondilu it does work for generic methods 13:54
but not for new?
I suppose the object is not yet fully constructed so it can't call downwards candidates or something? 13:55
Voldenet calling derived class methods from base class is not something I'd expect to work 15:17
m: role A { multi submethod new { samewith self, "foo" }; }; class B does A { multi submethod new(Str $s) { say $s } }.new 15:20
camelia foo
Voldenet you can use new as well
Voldenet but it's somewhat confusing to read 15:24
grondilu from the docs: "A Submethod is a method that is not inherited by child classes." 17:33
so I don't quite understand why the code above works as it does 17:34
grondilu shouldn't class B not know about the submethod defined in A? 17:34
lizmat it's a role, not a class 17:35
and they're both multis
so the submethod in B does not shadow the one from the role A 17:36
and you're calling without parameters, so that will call the one from the role A
m: class A { multi submethod new { samewith self, "foo" }; }; class B is A { multi submethod new(Str $s) { say $s } }.new
camelia Cannot resolve caller new(B:U: ); none of these signatures matches:
(B: Str $s, *%_)
in block <unit> at <tmp> line 1
lizmat grondilu ^^ 17:37
grondilu scraches his head
Voldenet >it's somewhat confusing to read 17:38
;)
grondilu m: role A { multi method subnew { samewith "foo" }; }; class B does A { multi method new(Str $s) { say $s } }.new 17:41
camelia ( no output )
lizmat grondilu: because your B.new is also a multi, the .new() will dispatch to Any.new 17:42
grondilu I see. the constructor in B can still be a method. I think that's what i want
lizmat A common idiom is e.g.:
m: class A { has $.foo; method new($foo) { self.bless(:$foo) } }; dd A.new(42) 17:43
camelia A.new(foo => 42)
grondilu yeah I know that idiom 17:44
I write it quite a lot but I wanted a generic role with a default constructor. 17:45
using a submethod one might do the job 17:46
Voldenet Using factory method is other solution for this 17:51
m: sub new-something($type) { $type.new("foo") }; class B { multi method new(Str $s) { say $s; self.bless(); } }; new-something(B).say 17:52
camelia foo
B.new
Voldenet this massively reduces complexity, because custom constructor is decoupled from the class 17:53
grondilu I like roles, though. I like being able to write something that is very generic, and leave details to inheriting objects. 17:55
I see raku's roles like C++'s abstract classes, but maybe that's a wrong comparison? 17:59
s/like/as/
well maybe it is, after all the point of roles is composition, now that I think about it. 18:01
not inheritance.
lizmat it's my understanding that you could see it that way... but then I'm no C++ expert
grondilu m: class A { multi method new {...}; multi method new { samewith "foo" }; }; class B does A { multi method new(Str $s) { say $s } }.new 18:02
camelia ===SORRY!=== Error while compiling <tmp>
A is not composable, so B cannot compose it
at <tmp>:1
grondilu m: class A { multi method new {...}; multi method new { samewith "foo" }; }; class B is A { multi method new(Str $s) { say $s } }.new
camelia Ambiguous call to 'new(B: )'; these signatures all match:
(A: *%_)
(A: *%_)
(Mu: *%attrinit)
in block <unit> at <tmp> line 1
grondilu m: class A { multi method new { samewith "foo" }; }; class B is A { multi method new(Str $s) { say $s } }.new
camelia Default constructor for 'A' only takes named arguments
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
grondilu m: class A { multi submethod new { samewith "foo" }; }; class B is A { multi method new(Str $s) { say $s } }.new 18:03
camelia ( no output )
grondilu yeah now I see I had no reason to use a role. A class was good enough.
so long as the generic constructor is a submethod
ah I forgot to check A.new is called 18:05
grondilu and in fact it isn't since there is no output 18:05
oh well
melezhik .tell SmokeMachine - any success with SparkyCI? 18:21
tellable6 melezhik, I'll pass your message to SmokeMachine
Voldenet grondilu: the C++ analogy makes it all confusing – derived methods are not going to be called properly in constructors 18:37
so `struct B { virtual void x() {} B() { x(); } }; struct D : public B { void x() { /* not going to be called */ }};` 18:39
however it would work in methods
[Coke] ended up writing his latest dumb script using proc::async wrapper around curl since that works on windows just fine. 18:40
japhb [Coke]: I do appreciate you letting me know about the CBOR::Simple problem on Windows. Good catch. 18:51
[Coke] Sure, happy to be a canary 19:02
Nemokosch well, it won't be called if the call should take place in the base constructor 19:06
however, I think this is inherently a virtual method thing because virtual methods are "data" 19:10
(obviously it wouldn't even arise which function is called if x weren't virtual so there's that)
[Coke] ... ugh. this API restricts you to get the first X elements... so you can't use the API to get all the data out. It's already paged... wtf. 19:11
(so if I ask for page... 21 or so, *barf*)
Nemokosch anyway, I didn't quite follow and I barely know anything about Raku OO; I've never used the language that way 😄 19:17
[Coke] oh, it's elasticsearch. (but I'm really going for a data dump, not a search) 19:31
japhb (Having to work around "cleverness")-- 19:40
[Coke] on the plus side, I do feel clever now that I got this working. :) 19:45
japhb Heh 19:47
Xliff \o 20:06
m: my $a =- 0; while (True) { NEXT { $a++ }; last if $a > 5 } 20:07
camelia ( no output )
Xliff Was there no RWN, yesterday? 20:49
El_Che no 20:51
good weather
hhcryfqnut what's the preferred place to ask questions about Raku's documentation? Stack Overflow? or should I open an issue in github.com/Raku/doc  ? maybe not --it's not really an issue i guess 21:57
Xliff hhcryfqnut: You can ask, here 22:41
SmokeMachine . 23:15
tellable6 2022-04-19T18:21:03Z #raku <melezhik> SmokeMachine - any success with SparkyCI?
SmokeMachine .tell melezhik I'm trying... but it's odd: the build list says it has failed, but the report says all tests have passed 23:17
tellable6 SmokeMachine, I'll pass your message to melezhik
melezhik . 23:29
tellable6 2022-04-19T23:17:57Z #raku <SmokeMachine> melezhik I'm trying... but it's odd: the build list says it has failed, but the report says all tests have passed
melezhik SmokeMachine I see that, this is SparkCI bug
I am working on it
this is really weird, as this happens on and off and I can't nail it down )))
so meanwhile, just look at the repot log ))), sorry for the inconvenience caused ... 23:30
I changed build statuses in database manually to avoid confusion, but I need to figure out the cause ... 23:31
SmokeMachine melezhik: thanks! :) 23:53