🦋 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.
tonyo m: grammar RF { rule TOP { ^ <str-list> $ }; token str-list { |"ABC"|"DEF"|"GHI" }; }; RF.parse("ABC").say; RF.parse("abc").say; # rf 08:25
camelia 「ABC」
str-list => 「ABC」
Nil
Homer_Simpson . 09:06
CIAvash m: grammar RF { rule TOP { ^ < ABC DEF GHI > $}; }; RF.parse("ABC").say; RF.parse("abc").say; # rf 10:05
camelia 「ABC」
Nil
CIAvash m: my @a = < ABC DEF GHI >; grammar RF2 { rule TOP { ^ @a $}; }; RF2.parse("ABC").say; # rf 10:19
camelia 「ABC」
Anton Antonov @lizmat "sorry, /me is too stockholm syndromed to vim" -- I assume you realize that some people might use this statement against you. 13:42
stevied is there any practical difference between a module's "long name", "module specification" or "identity"? Are these terms pretty much synonymous? 18:01
atroxaper Hello #raku ! 18:45
How can I reference to a role parameter type outside of the role? 18:46
m: role Par[::T] { method m(--> T) {} }; sub s(Par[::T] $p --> T) { $p.m } 18:47
camelia ===SORRY!=== Error while compiling <tmp>
No such symbol 'T'
at <tmp>:1
------> T] { method m(--> T) {} }; sub s(Par[::T⏏] $p --> T) { $p.m }
rf m: role Par[::T] { method m(--> T) {} }; sub s(Par[T] $p --> T) { $p.m } 22:39
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
T used at line 1
Nemokosch I'm not sure what this is supposed to mean 22:45
looks like fake templating 22:46
rf I'm just seeing if there is a way to do what @atroxaper is trying
I'm not sure it is possible 22:47
rf atroxaper: I would just avoid the type system in this case. I had a similar problem writing my result monad library, but in the end I think it gets more in the users way to type like this. 22:56
But there may be a way, but I am not sure.
Voldenet m: role s[::T] { submethod CALL-ME(T $s –> T) { $s }}; say s[Int](1) 23:53
camelia ===SORRY!=== Error while compiling <tmp>
Malformed parameter
at <tmp>:1
------> role s[::T] { submethod CALL-ME(T $s⏏ –> T) { $s }}; say s[Int](1)
expecting any of:
constraint
Voldenet m: : role s[::T] { submethod CALL-ME(T $s) returns T { $s }}; say s[Int](1) 23:54
camelia ===SORRY!=== Error while compiling <tmp>
Bogus statement
at <tmp>:1
------> :⏏ role s[::T] { submethod CALL-ME(T $s) r
expecting any of:
colon pair
Voldenet m: role s[::T] { submethod CALL-ME(T $s) returns T { $s }}; say s[Int](1)
camelia 1
Voldenet this is the closest you can probably get to what you want
m: role Par[::T] { method m() returns T {} }; role s[::T] { submethod CALL-ME(Par[T] $p) returns T { $p.m }}; say s[Int](Par[Int].new) 23:55
camelia Internal error: inconsistent bind result
in submethod CALL-ME at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet uh oh uh