🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | 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 8 June 2022.
guifa o/ 06:22
Xliff \o 12:55
Can the current implementation of macros be used like a sub? 12:56
Xliff I would like to make a set of need statements reusable. Is that possible with the current implementation? 13:01
m: use MONKEY-SEE-NO-EVAL; use experimental :macros; macro hai { quasi { say "O, HAI" } }; hai 13:02
camelia O, HAI
Xliff That works... but this doesn't...
Xliff use MONKEY-SEE-NO-EVAL; use experimental :macros; my $a = 42; macro a { quasi { $a } }; say a 13:02
evalable6 (Mu)
Xliff I would expect that second one to emit '42'. Can someone tell me what I am doing wrong? 13:03
jjatria Xliff: I think the issue is that the value needs to be available at compile time 13:25
m: use MONKEY-SEE-NO-EVAL; use experimental :macros; constant A = 42; macro a { quasi { A } }; say a
camelia 42
jjatria See the end of docs.raku.org/syntax/macros 13:26
jjatria m: use MONKEY-SEE-NO-EVAL; use experimental :macros; macro a($x) { quasi { {{{$x}}} } }; my $a = 42; say a $a 13:33
camelia 42
jjatria That also works
Xliff Ah! Thank you both! 13:37
Can macros be exported? 13:38
m: package A { macro b is export { quasi { say 'HI!' }; }; };
camelia ===SORRY!=== Error while compiling <tmp>
Use of macros is experimental; please 'use experimental :macros'
at <tmp>:1
------> package A { macro⏏ b is export { quasi { say 'HI!' }; }; }
Xliff m: use experimental :macros; package A { macro b is export { quasi { say 'HI!' }; }; };
camelia ( no output )
Xliff m: use experimental :macros; package A { macro b is export { quasi {need NativeCall }; }; }; import A; b; CArray.^name.say 13:46
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
CArray used at line 1. Did you mean 'array', 'Array'?
Xliff Hmmm.. -- Do I need to worry that the need call is lexicalized in the quasi block, when it should be lexicalized into the calling one? 13:47
dakkar I fear that falls under "macros aren't fully implemented" 14:09
I agree it should affect the caller
Xliff Ah well. I was hoping there was a way to make my life easier by putting repetitive code like need statements within a macro. 14:17
All in due time, I guess.
dakkar m: use experimental :macros; package A { macro b is export { quasi {use NativeCall }; }; }; import A; b; CArray.^name.say 14:31
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
CArray used at line 1. Did you mean 'array', 'Array'?
dakkar ok, the problem wasn't that `need` doesn't import symbols
dakkar Xliff: github.com/LLFourn/p6-CompUnit-Uti...-exporting may help make your life easier 14:39
tellable6 dakkar, I'll pass your message to Xliff
jjatria Looking more into SameSite, I don't think that can be done without access to the public suffix list, which we don't seem to have at the moment in Raku 14:59
And I guess in that case, the hardest thing would be to make it so that it doesn't go stale (since the list is updated several times a week) 15:00
I did see a Rust library that checked for updates every day and auto-minted a release, but I don't think we have any prior art for that sort of thing in zef 15:01
lizmat clickbaits rakudoweekly.blog/2022/07/04/2022-...re-videos/ 19:05
coleman Bruce's intro to Raku is helpful for me 19:29
lizmat good to hear! 19:30
Geth planet.raku.org: 062b21a056 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | perlanetrc
perl6.party appears to have been reset
19:35
El_Che A 20:35
guifa m: grammar A { token TOP { <b: 1> }; multi token b:x ($c) { $c }; multi token b:y ($c) { $c$c }; }; A.parse('1').say 21:39
camelia No such method 'b' for invocant of type 'A'. Did you mean 'wb'?
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
guifa This feels...not right
if you remove the signature, and replace $c with a . , things are called properly as you'd expect
basically, you can do multi with signatures, or no-multi with signatures, but not multi with signatures 21:42
uzl[m] lizmat++ for the weekly. Informative as always! 22:19