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.
00:48 Kaipei joined 00:52 Kaiepi left 01:31 Kaiepi joined 01:33 Kaipei left 07:00 deoac left 07:54 dakkar joined 10:37 jaguart left
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/08/15/2022-...succeeded/ 11:38
11:48 razetime joined 13:16 razetime left 13:27 razetime joined 14:52 deoac joined 15:11 razetime left 15:22 razetime joined 15:33 razetime left 16:05 lizmat_ joined 16:06 Kaipei joined 16:08 Kaiepi left 16:09 lizmat left 16:20 lizmat_ left, lizmat joined 16:39 dakkar left
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
18:05 deoac left 18:08 deoac joined