🦋 Welcome to the IRC channel of the core developers of the Raku Programming Language (raku.org #rakulang). This channel is logged for the purpose of history keeping about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Logs available at irclogs.raku.org/raku-dev/live.html | For MoarVM see #moarvm
Set by lizmat on 8 June 2022.
gfldex m: my &foo = BEGIN 'proto sub foo(|) {*}'.EVAL; multi sub foo($i) { }; foo(42); 13:00
camelia ===SORRY!=== Error while compiling <tmp>
Redeclaration of routine 'foo'. Did you mean to declare a multi-sub?
at <tmp>:1
------> foo(|) {*}'.EVAL; multi sub foo($i) { }⏏; foo(42);
expecting any of:
horizontal whi…
gfldex m: constant &foo = BEGIN 'proto sub foo(|) {*}'.EVAL; multi sub foo($i) { }; foo(42);
camelia ( no output )
gfldex m: constant &foo = BEGIN 'proto sub foo(|) { nextwith() }'.EVAL; multi sub foo($i) { }; foo(42);
camelia nextwith is not in the dynamic scope of a dispatcher
in sub foo at EVAL_0 line 1
in block <unit> at <tmp> line 1
gfldex Is there any way to make that work? 13:01
This is an urgent question. A blogpost depends on it! :->
lizmat what should the nextwith dispatch to? 13:02
gfldex m: constant &foo = BEGIN 'proto sub foo(|) { nextwith(42) }'.EVAL; multi sub foo($i) { }; foo(42); 13:03
camelia nextwith is not in the dynamic scope of a dispatcher
in sub foo at EVAL_0 line 1
in block <unit> at <tmp> line 1
gfldex Call the next candidate.
This is golfed and as such makes little sense. 13:04
lizmat but you're calling it in the proto? That's generally where the buck ends ?
gfldex ungolfed: gist.github.com/gfldex/10c78c78482...f15326279d 13:05
Then I may not understand proto (what is likely).
lizmat without optimizations, the proto sub foo is the sub that gets called whenever you do "foo()" 13:07
that will then look at the given args and decide which of its candidates to actually run
(which is basically what {*} does) 13:08
proto foo(|) {*}
is just short for:
gfldex I want to modify args in the proto before the dispatch continues.
lizmat proto sub foo(|) { {*} }
samewith ? 13:09
gfldex samewith gives at least a different error message. 13:11
vrurg And yet it'd be better to have a special candidate which modifies and re-dispatches to the final one. 13:14
Or use a `my proto` in the lexical scope of your non-multi quasi-enum. 13:18
gfldex m: constant &foo = BEGIN 'multi sub foo(|) { samewith(42) }'.EVAL; multi sub foo($i) { }; foo(42); 13:23
camelia ===SORRY!=== Error while compiling <tmp>
Redeclaration of routine 'foo'. Did you mean to declare a multi-sub?
at <tmp>:1
------> ewith(42) }'.EVAL; multi sub foo($i) { }⏏; foo(42);
expecting any of:
horizontal whi…
gfldex I don't get that problem with a proto.
vrurg Onlystar is the only way to start looking for candidates. 13:33
lizmat A trick I've used in some of the P5 modules is: 13:37
BEGIN my &old-foo = &foo;
proto sub foo(|c) { if dispatch-new { {*} } else { old-foo(|c) } 13:38
Geth rakudo/main: 04ec9234cb | (Elizabeth Mattijsen)++ | src/Raku/Actions.nqp
RakuAST: streamline handling of deprecated charnames
14:09
Geth rakudo/main: cfcf9fb3e9 | (Elizabeth Mattijsen)++ | 2 files
RakuAST: Streamline slang nibbling

  - dynvars should be uppercase, so @*NIBBLES instead of @*nibbles
  - use native ints where possible
  - collect nibbles in lexical array, publish to dynvar at end
  - other shortcuts to dynvars added
14:53
[Tux] Rakudo v2023.08-217-gcfcf9fb3e (v6.d) on MoarVM 2023.08-3-g2f8234c22
csv-ip5xs0.905 - 1.001
csv-ip5xs-205.418 - 5.989
csv-parser3.868 - 4.462
csv-test-xs-200.344 - 0.398
test7.435 - 7.459
test-t1.513 - 1.575
test-t --race0.907 - 1.228
test-t-2021.498 - 22.615
test-t-20 --race6.787 - 7.587
15:11
[Coke] wonders if any of that csv testing can be done with rakuast. Guessing not yet! 17:01
nifty: news.perlfoundation.org/post/maint...ugust_2023 17:08
(perl not raku but nice to see some insight into core hacking on something else)