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:00
kjp left,
kjp joined
|
|||
avuserow | hi friends, how can I "re-export" a value from a module? meaning, if I have module A::Base that defines an enum, I want to import it into A::C, and then have A::C export it too | 00:19 | |
antononcube | I asked that question some time ago (except for a sub, not enum.) After advice from lizmat I used EXPORT. | 00:26 | |
See "Data::Generators" for an example of exporting subs from "Statistics::Distributions". | 00:32 | ||
avuserow | thanks, I'll take a look | 00:34 | |
I think my hang-up with enums might be that I need to export each of the enum's values too | 00:35 | ||
antononcube | Of course, I should have provied a link; here it is : github.com/antononcube/Raku-Data-G...akumod#L19 | 00:36 | |
SmokeMachine | avuserow: maybe this example could help you on that… sorry for the code being a bit confusing , but that is an example of re-exporting all exports from a module… you could also have something different from ALL, and re-export that subset… | 01:18 | |
avuserow | thanks, haven't gotten to dig into them yet, but looks promising | 02:16 | |
03:12
stanrifkin_ joined
03:15
stanrifkin left
|
|||
avuserow | okay yeah it's just that easy: sub EXPORT { Map.new: 'MyEnum' => MyEnum, 'ValueA' => ValueA, ... } | 03:29 | |
of course you can use `map` to handle all the values, but this enum is three values and is very unlikely to expand, so I'll write it out | 03:30 | ||
06:07
ACfromTX left
06:20
ACfromTX joined
07:48
human-blip joined
10:28
stanrifkin_ left
11:06
stanrifkin joined
17:04
human-blip left
17:06
human-blip joined
19:17
human-blip left
19:18
human-blip joined
|