🦋 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.
codesections m: class B {...}; class A { has $.bar; method COERCE(B) { A.new(:bar<42>) }}; class B { method FALLBACK(|c) { dd c; Hash }; method foo { A(self)}}; B.foo 01:56
camelia \("A")
Impossible coercion from 'B' into 'A': method A returned a type object Hash
in method foo at <tmp> line 1
in block <unit> at <tmp> line 1
codesections Why does ^^^^ call B.FALLBACK instead of A.COERCE? Am I misunderstanding the mro of the new coercions, or is there a bug? 01:58
summerisle i don't recall what the title of the page describing type parameters was, does anyone know? 02:10
codesections Like Array[Str]? iirc, it's under Role, but I'm not sure 02:11
summerisle parameterized roles 02:12
just found it
summerisle on a related note, are there any good examples of the semantics of multi roles (docs mention that role parameters can have similar semantics to multi dispatch) 02:29
summerisle can you destructure a hash when assigning? 04:56
codesections does destructuring a slice do what you want? 05:09
m: my %h = (:a<b>:c<d>); say my ($foo, $bar) = %h<a c>
camelia (b d)
guifa2 also 05:12
m: my %x; %x<a b> = 1, 2; say %x
camelia {a => 1, b => 2}
guifa2 but you can't do, eg 05:13
my %x = :1a, :2b; my %(:$a, :$b) = %x; 05:14
moon-child I want to be able to index a scalar with any value (or, at least, any natural) and get back the same scalar. Is there a way to do that? 05:18
moritz moon-child: yes, you can define your own GET-POS method; see docs.raku.org/language/subscripts 07:18
moon-child but can I change the default AT-POS? 07:25
CIAvash Happy new year everyone! 😀 10:21
El_Che CIAvash: the Persian one? 11:14
if so, nice
CIAvash Yeah. I was kinda joking with people who say "happy new year everyone" when it's new Gregorian year, although the most popular one. 🙂 11:16
El_Che hehe
the most hardcore are the one that stayed on the Julian calender :P 11:17
sligtly off
El_Che github.com/patrickmn/go-cache 11:44
met dat kan ik caching toevoegen aan de jwtintrospect ding
zoals keep validation for x time
El_Che damn 11:45
wrong window :)
brown121407 Hi! I just came across Raku about a month ago and it stayed in my mind that I should probably learn it. It looks like a very fun language to work in! I'm curios if there are people doing – sorry to put it this way – serious things with it. 13:52
codesections brown121407: hi and welcome! There definitely are - one recent example that comes to mind is the project described in this talk at FOSDEM fosdem.org/2021/schedule/event/rak...as_server/ 13:57
brown121407 codesections, thank you, that looks interesting. 14:09
I think I'll start solving university homework in Raku also besides the "approved" languages, so I get some practice. 14:10
codesections Sounds like a good plan 14:11
Xliff \o 19:22
Constant names can't be fully qualified?
m: class ICal::Property::DTEnd { }; constant ICal::Property::DateTimeEnd is export := ICal::Property::DTEnd; 19:23
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3Cal::Property::DTEnd { }; constant ICal:7⏏5:Property::DateTimeEnd is export := ICal
Xliff m: class ICal::Property::DTEnd { }; constant DateTimeEnd is export := ICal::Property::DTEnd;
camelia ( no output )
Xliff Another question... can packages be augmented? 19:24
summerisle what are the limits of multiple dispatch on destructured parameters? 19:55
i have a situation where multiple dispatch would be very handy, but the mop seems to get confused when trying to look up the method 19:56
raydiak Xliff: from here, it looks like everything you've asked about is better handled by subclassing. why all the monkey-patching? 20:01
raydiak summerisle: I don't recall exacly how destructuring interacts with multi-dispatch. If you could golf us down an example to play with, it might help 20:07
summerisle yeah, that's what i'm trying to do 20:08
here's an excerpt with some comments but it doesn't really provide a working example gist.github.com/caea726269872be110...5850829243 20:10
summerisle Node[ClassTag] has according declare() implementations 20:11
the documentation for multi is really frustrating because it doesn't at all go in to semantics, which would be really helpful
it just shows an extremely basic overloading example that barely scratches the surface of use cases for multi 20:12
Xliff raydiak: I am subclassing, I would like to make an alias to a subclass without having to redeclare the entire class under another name. 20:14
m: class C { }; constant A::B = C
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3class C { }; constant A:7⏏5:B = C
Xliff My real question is why doesn't this ^^ work? 20:15
I could try to declare a package A and declare B within it, but I have many of these files and can't have said package defined in all of them. 20:16
summerisle Xliff: subset A::B of C; 20:18
m: class C {}; subset A::B of C; say C ~~ A::B;
camelia True
Xliff summerisle: Hmm... Will look into that. Thanks!
summerisle also, note that A.HOW ~~ PackageHOW 20:19
Xliff summerisle++ # Works like a treat! Thanks 20:21
summerisle Xliff: glad to help 20:22
raydiak m: multi foo ([], [$a], :$) { say $a }; multi foo ([], [$a, *@rest], :$) { say "foo" }; foo [], [1]; foo [], [1,2] 20:47
camelia 1
foo
summerisle right, which is weird because i put together a test to similar effect myself 20:48
raydiak I cannot duplicate your first problem, that's why you golf more. narrow it down until you find the difference, because your problem doesn't seem to be what you think it is. the second problem is because @ expects a Positional argument, while *@ expects any number of anything 20:50
summerisle right, but the second @ is always given a Positional 20:51
while i don't expect you to fix this, here's the code and its input for some context at least - gist.github.com/RomanHargrave/a9b7...467584504a
i'll see if i can figure out what it's tripping over
raydiak similarly with the second failure as the first, I cannot reproduce it with identical signatures. I'll look around elsewhere in your code, see if anything jumps out at me 21:04
softmoth Hi, friends. I've discovered a multi-threading crash in Template::Mustache, and could use some help fixing it: github.com/softmoth/raku-Template-.../issues/41 21:55
It's getting X::HyperRace::Died with `Cannot invoke this object (REPR: Uninstantiable; Callable)` 22:00
If anyone has any pointers on likely culprits, I'd be very grateful. 22:01
[Coke] . 23:37
moon-child .. 23:47
raydiak summerisle: I got way distracted by that. Haven't had a lot of luck. I do suspect a bug but not sure exactly which combination of circumstances triggers it yet. Certainly that candidate list in the error message looks concerning 23:48
summerisle hmm 23:49
luckily i've worked around it
and simplified the grammar too
raydiak glad you moved forward, anyway. I might poke at it again later for fun and a possible bug report 23:55