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. |
|||
06:22
CIAvash joined
|
|||
briandouglas_71953 | Go ahead, I intend to package it as a module. | 07:25 | |
07:56
CIAvash left
09:59
jaguart joined,
jaguart left
11:23
habere-et-disper joined
11:48
habere-et-disper left
12:35
CIAvash joined
13:11
CIAvash left
15:04
CIAvash joined
16:06
CIAvash left
|
|||
lucs | Is there a shortcut to declare an enum that holds geometrically increasing values, (1, 2, 4, 8, ...) for example? | 16:48 | |
Looking for a shortcut for something like enum Baz (a => 1, b => 2, c => 4, ...), but during development, I may want to change the order of the letters (for readability/understanding), and if I could avoid having fix the associated number, that would be great. | 17:04 | ||
MasterDuke | m: enum A (("a".."d") Z=> (1, 2, 4 ... *)); say d.value # lucs | 18:33 | |
camelia | 8 | ||
lucs | MasterDuke: Aha, beautiful. Thanks. | 19:00 | |
briandouglas_71953 | Can I make multiple files under a module? For example can multiple files use unit module MyModule;? Use case is to have classes in seperate files. So ClassA.raku and ClassB.raku are both in unit moduls MyModule and can be accessed like so MyModule::ClassB.new. | 20:36 | |
roguerakudev | @briandouglas_71953 you can do two separate files and unit class MyModule::ClassA and unit class MyModule::ClassB respectively if you want them referenced like MyModule::ClassA/B | 21:59 | |
you'd want both files to live in a MyModule directory and be named as you said, although the convention for module files is .rakumod rather than just .raku although the latter will work fine | 22:00 | ||
I've found that generally one has to declare things in the same way you ultimately want them referenced, so take this for example unit module Foo; class Bar { ... } | 22:02 | ||
you'd import that with use Foo::Bar but then use it with just Bar | |||
briandouglas_71953 | Thanks for this. How would I import classes with in the same module. So both ClassA and ClassB are in unit module MyModule. Now I want to use ClassA inside ClassB? Currently if I try to do MyModule::ClassA it isn't found. | 22:11 | |
All files are located in the same directory lib. | 22:12 | ||
Actually I think I've got it. I have a NotFoundException.rakumod with a NotFoundException class. I can just write use NotFoundException; in side the lib and it works... | 22:34 | ||
Nah, doesn't work. Specifically I can't understand why these two imports are not found: github.com/BrianDouglasIE/MothTrap...umod#L3-L4 | 22:56 |