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:34 jaguart left 00:41 Kaiepi left 01:41 razetime joined 02:27 razetime left 02:42 jaguart joined 04:26 Kaiepi joined
jaguart in this signature: sub foo(::bar){...} ===> what is ::bar ? 04:37
04:42 razetime joined
Kaiepi it's a type capture 04:45
jaguart thanks - so I can pass in a Type as in foo(Int); 04:49
Kaiepi yeah 04:50
it captures the type, so any object is fine
jaguart oh cool - so if I foo(2) -> foo would get the Type instance in ::bar? 04:53
as in the Int
Kaiepi yep! 04:54
jaguart where should I be looking in the docs to find this? I looked at docs.raku.org/language/variables 05:00
thinking it was a sigil...
Kaiepi `Signature` has a bunch of the docs on how to work with its parameters docs.raku.org/type/Signature#index...pe_capture 05:05
jaguart thank you ) 05:08
Kaiepi np
jaguart Is there a way to find the EXPORTs of a module, ie the attributes and methods that are 'is export'? 05:57
Nahita `YourModule::EXPORT::DEFAULT::.keys` might help; docs.raku.org/language/modules#Introspection 08:10
08:33 Heptite left 08:59 Kaiepi left 09:30 razetime left 09:43 Kaiepi joined 13:46 elcaro_ left 13:47 elcaro joined 16:54 razetime joined 17:16 Heptite joined 17:18 razetime left 18:52 mcmillhj joined 20:33 mcmillhj left 21:14 Kaiepi left 21:18 Kaiepi joined
jaguart I'm still stuck with EXPORTS 23:35
This seems to work: 23:36
m: module Foo { our $bar is export; sub baz is export { "baz"; } }; sub ex($o) { say "=>: ", $o.WHO<EXPORT>.WHO.keys; }; ex(Foo);
camelia =>: (ALL DEFAULT)
jaguart But I cannot seem to dig into ALL :(
m: module Foo { our $bar is export; sub baz is export { "baz"; } }; sub ex($o) { say "=>: ", $o.WHO<EXPORT>.WHO<ALL>.keys; }; ex(Foo); 23:37
camelia =>: ()
Nemokosch are you sure ALL isn't just downright empty? 23:40
jaguart m:
m: module Foo { our $bar is export; sub baz is export { "baz"; } }; sub ex($o) { use MONKEY-SEE-NO-EVAL; say "=>: ", EVAL($o.^name ~ "::EXPORT::ALL::.keys"); }; ex(Foo); 23:41
camelia =>: (&baz $bar)
jaguart ah found it )
m: module Foo { our $bar is export; sub baz is export { "baz"; } }; sub ex($o) { say "=>: ", $o.WHO<EXPORT>.WHO<ALL>.WHO.keys; }; ex(Foo);
camelia =>: ($bar &baz)
jaguart I needed the Stash of ALL - was assuming ALL was already a Stash 23:42
my ask of Santa and his Raku Elves is: Metamodel::PackageHOW.exports() ===> returns a list of exports so I can $m.^exports like my classy friends so $c.^attributes 23:57
not quite confident enough to mixin Metamodel::PackageHOW yet... 23:58