🦋 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.
ab5tract Ah, for some reason I thought you were generating both signatures 07:21
just at different times
ab5tract regardless: 07:30
m: sub foo(Int $a, Str $b is raw) { }; my $ast = Q:qq| {&foo.signature.raku} |.AST; say $ast.statements[0].expression.signature.parameters
camelia (RakuAST::Parameter.new(
type => RakuAST::Type::Simple.new(
RakuAST::Name.from-identifier("Int")
),
target => RakuAST::ParameterTarget::Var.new(
name => "\$a"
)
) RakuAST::Parameter.new(
type => RakuAST::Type::Sim
ab5tract note that .AST is currently considered "unofficial", but I personally can't imagine that we would ship 6.e without some way of converting expressions to AST 07:32
wayland76 ab5tract: thanks! 07:53
wayland76 m: sub foo(Int $a, Str $b is raw) { }; my $ast = Q:qq| {&foo.signature.raku} |.AST; say $ast.statements[0].expression.signature.return 11:16
camelia Attempt to return outside of any Routine
in block <unit> at <tmp> line 1
wayland76 m: sub foo(Int $a, Str $b is raw) { }; my $ast = Q:qq| {&foo.signature.raku} |.AST; say $ast.statements[0].expression.signature.returns
camelia (Node)
wayland76 Interesting! How do I get a programmatically-created signature to have a "returns" value like that one? 11:17
(the second one -- my first run had a bug)
ab5tract the constructor RakuAST::Signature.new takes a list of RakuAST::Parameter objects (:$parameters) as well as a RakuAST::Node object (:$returns) 11:46
since RakuAST::Node is essentially the super-class of (almost) all RakuAST classes, that gives you a lot of leeway for what to return 11:47
ab5tract m: use experimental :rakuast; sub foo(Int $a, Str $b is raw) { }; my $ast = Q:qq| {&foo.signature.raku} |.AST; my $ret-ast = Q| Int |.AST; dd RakuAST::Signature.new(parameters => $ast.statements[0].expression.signature.parameters, returns => $ret-ast) 11:49
camelia Int $a, Str $b is raw --> Int
xinming m: my constant role-a = role :: { method t () { "1".say; } }; role :: { "2".say; }; my constant T = anon class T { method t () { "t".say; } } but role-a; T.new.t; 11:59
camelia 1
xinming In this exampe, is it possible to make a list of of roles dynamically applies to the same class, and compose different "classes" ?
something like anon class T { method t () { "t".say } } but @role-list-enabled; 12:00
Xliff \o 16:46
I'm trying to pick up all of the caps in a camel cased var.
I have this but it doesn't work.
m: say "MyWeirdlyCamelCasedVar" ~~ / (\w).+?[ <[a..z]>(<[A..Z]>) .+?]+ /
camelia 「MyWeirdlyCa」
0 => 「M」
1 => 「C」
Xliff m: say "MyWeirdlyCamelCasedVar" ~~ / (\w).+?[ <[a..z]>+(<[A..Z]>) ]+ / 16:49
camelia 「MyWeirdlyCamelCasedV」
0 => 「M」
1 => 「C」
1 => 「C」
1 => 「V」
Xliff Aha! 16:50
ab5tract m: say "MyWeirdlyCamelCasedVar" ~~ / [(<:Lu>)<:Ll>+]+ / 17:08
camelia 「MyWeirdlyCamelCasedVar」
0 => 「M」
0 => 「W」
0 => 「C」
0 => 「C」
0 => 「V」
ab5tract Xliff: your last example seems to be missing the 'W' 17:09
Xliff ab5tract: Thanks, I fixed that in the greater project. 17:29
ab5tract My pleasure 17:30
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/05/27/2024-...-incoming/ 18:32
antononcube .seen bduggan 18:54
tellable6 antononcube, I saw bduggan 2023-03-14T18:02:06Z in #raku-dev: <bduggan> Okay, cool -- good to know, and thanks for the comments
tbrowder lizmat++, excellent weekly, as usual! 20:00
thanks so much! 20:01
lizmat yw :-)
tbrowder i just had a weird experience (maybe self-inflicted). my module tests fine locally, then, on github, zef install finds a pod error not found locally! 21:28
lizmat strange 21:29
tbrowder it could be a precompile issue. is there a way get raku or zef to recompile a lib path?
lizmat rm -rf ~/.raku/precomp 21:30
tbrowder yes, but i was hoping for a more friendly way for noobs 21:31
lizmat well... ideally it shouldn't be needed
[Coke] n00bs don't need it
tbrowder true
[Coke] Why do YOU need it? 21:32
tbrowder laziness
and avoid possibility of ff nuking stuff 21:33
gfldex .seen raiph 21:39
tellable6 gfldex, I saw raiph 2024-05-14T09:12:22Z in #raku: <raiph> m: say $*RAKU.compiler.version
tbrowder ok, i narrowed prob a bit. using zef and mi6 testing locally in the module repo work fine. 22:13
however, using "zef install . " fails and it finds the pod error. 22:14
so, how can that be fixed?
the remote testing was done with raku v2024.02 and v2024.04 22:15
[Coke] one of your own pod files? 22:18
you can add a test that verifies your pod?
github.com/Raku/doc/blob/main/t/02...d.rakutest 22:19
tbrowder i can probably use Pod::Load for one, but what is zef doing different on install vs test locally?
i'm sure i'm not the only person making subtle pod errors. 22:20
tbrowder thnx for the link, maybe mi6 and zef could add that test. 22:25
ab5tract anyone know if there is a path in Windows that is not writable by the default user and, if so, what it is? 22:27
ab5tract I guess 'C:\Windows\system32' should work alright 22:45
ab5tract Never mind, found a better approach to generating failures 23:19