This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/08/15/2022-...succeeded/ 11:38
deoac sub foo {say "whoops!"};  debug(foo()); 16:43
How do I write sub debug() to get this to work? 16:44
Wait, that's wrone
class C { method foo {say "whoops!"};}; my $c = C.new; debug(c.foo()); 16:45
where the argument to debug() could be any executable code, principally say() and print() statements. 16:47
lizmat m: my &debug = -> { }; debug(42); &debug = &say; debug(42) 17:00
camelia Too many positionals passed; expected 0 arguments but got 1
in block <unit> at <tmp> line 1
lizmat m: my &debug = -> $ { }; debug(42); &debug = &say; debug(42)
camelia 42
lizmat first time debug is called, is an effective no-op, the second time it says what it got 17:01
Nemokosch is this the same thing?
lizmat it's an example of code in a variable
m: sub foo($value, &debug = -> $ { }) { debug $value }; foo 42; foo( 42, &say ) 17:02
camelia 42