🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
equinox hello 11:42
m: multi si(Str $s, Int $i) | (Int $i, Str $s) { die "dispatch went wrong" unless $s ~~ Str && $i ~~ Int; "s:$s i:$i"; }; si "", 2
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> multi si(Str $s, Int $i)⏏ | (Int $i, Str $s) { die "dispatch went
expecting any of:
new name to be defined
equinox so this doesn't work, doesn't compile but is there something i miss or it is not implemented yet? 11:43
i take the code from roast 11:44
lizmat equinox: from where in roast ? 12:10
lizmat equinox: also, what do you need inside the "si" multi? strings or integers? 12:11
equinox36 $s as a String, $i as an Integer 12:12
lizmat m: multi si(Str $s, Int $i) { dd }; multi si(Int $i, Str $s) { dd }; si 42, "foo"; si "foo", 42
camelia sub si(Int $i, Str $s)
sub si(Str $s, Int $i)
lizmat ^^ 12:13
equinox36 yes but
trying to write 1 multi only
github.com/Raku/roast/blob/master/...gnatures.t
lizmat interesting 12:14
lizmat even though that file is in roast, is is *not* part of the spectest, and it also doesn't compile, as you already saw 12:14
equinox36 oh 12:15
lizmat so I'd say it's a definite case of NYI
equinox36 didn't know spectest is something different than the entire repository
where do you check the spectest?
lizmat in my rakudo source dir, I did: raku t/spec/S06-signature/multiple-signatures.t 12:16
to do the whole spectest, I do: make spectest
fwiw, I think it could be relatively implemented, by creating multiple candidates under the hood for you 12:17
for *your* case
but suppose the different signatures refer to differently named parameters 12:18
then the body of the sub wouldn't know what to do?
ah, looking at the tests, apparently it *is* forcing the same set of parameter names 12:19
"multis with multiple sigs must have the same set of formal variables"
equinox36 so as long as the variable name and the sigil is the same (and exactly the same) among different signatures, order, types, named-ness can differ, right? 12:23
i think this is very cool, for example the `three` sub there in the test 12:24
what would be the sketch path for this to be implemented would you say?
lizmat the way I read the tests, indeed...
it's about what the names/sigils are inside the body, that matters, not how they appear in the signatures
which makes sense
but alas, NYI... PR's welcome! :-) 12:25
equinox36 i can try! (and fail probably) 12:26
what would be the sketch path for this to be implemented would you say? 12:27
lizmat 1. look in src/Perl6/Grammar.nqp where the boundary between end-of-sig and the body is being handled
(this is also handling traits btw, which could be an interesting and possibly complicating factor 12:28
2. introduce | as a way to specify another signature and keep track of the signatures, checking that all signatures have the same formal parameters 12:29
3. look where a completed body in the src/Perl6/Actions.nqp is being hooked up with the signature, and hook up all of the signatures with the same body 12:30
I'm probably forgetting things here :-)
equinox36 thank you 12:34
tonyo new version of fez is about to land where it should get rid of the bundling problems people are seeing with the weirdness in git's bundler and some tar commands not being available in certain OSes 19:02
xinming SmokeMachine: ping 19:17
SmokeMachine: do we have correct way to programatically to add columns to existing model? 19:18
SmokeMachine: What I'm trying to do is something like role for model, for example, article role will have many "required" columns, which can be a role, and exact model can add extra columns when needed. 19:23
xinming Or, is it possible to have something like, model_role keywords to generate roles for model. 19:33
I just think, probably, this is where macro can be useful in this case. 19:59
habere-et-disper I see a doubly escaped heading at top of page <[ ]>: 20:31
docs.raku.org/syntax/%3C[%20]%3E
or is it just me?
melezhik weekly: dev.to/melezhik/sparrowci-pipeline...-cicd-38c7 21:13
notable6 melezhik, Noted! (weekly)
melezhik o/
melezhik o/ 21:14
weekly: dev.to/melezhik/sparrowci-pipeline...-cicd-38c7
notable6 melezhik, Noted! (weekly)
guifa knows that with RakuAST he could make `multi sub foo (Str, Int) | (Int, Str) { ... }` work 21:20
equinox cool 21:22
i found  `token multisig` in Grammar.nqp after lizmat's directions
and it does say "Not really implemented yet." 21:23
guifa (the problem is that RakuAST isn't around. Unfortunately, certian parts of compiling with QAST and $*W is a bit opaque to me still) 21:25
if you don't mind a very small restriction, I could make it for you in a trait 21:26
equinox oh my 21:27
i don't mind, what's the restriction 21:28
guifa wouldn't have control over two the order of two same types 21:31
equinox my main excitement was about it allowing a parameter to be passable as named as well as positional
guifa ah
I could do that one too, I was thinking mainly on the unordered bit
lemme see what I can come up with
equinox ty 21:32
guifa will probably take me a bit since I'm doing some other things, so don't hold your breath too much lol 21:36
equinox haha 21:37
okay, thanks, i leave but i read the logs 21:38
hope that didn't sound like a thread lol 21:39
English -.-
guifa ha not at all 21:43
guifa tio.run/##ZZPNbuIwEMfvPMVsFURAwUi7...9OuMN8szKW 22:21
/XcH1cgkvHGuolO2OGXqJgcUzNTX1k3JoDwZ7w1bgFRvTSq@ROJ2x9nIz8Ww/6yc5Qd3ptzQO0@P/vcl8nxGdfgvretMSGtnYKbQdf35a0cd/cplczgU1IdhCdZHcStvwJp0JaY3VMWkNkEn/vIzH2Fyj8FTSPDyMPQUxilxJB15mWTIl6SegKjhL4np3YUpNXShX0l/0Q2W73AQ
gist.github.com/alabamenhu/c4b1167...dbab835394 22:22
SmokeMachine xinming: a role should work for that… 22:45
xinming: like this: github.com/FCO/Red/blob/master/t/13-roles.t 22:47