00:04 ajr left
klebs greetings folks! I have been growing a raku repository with all source files uniquely named within a single folder. Now, there are many thousands of lines of code and I would like to split everything into separate namespaces! basically, I am wondering what is the most non-invasive way to do this! What do you think? 02:33
I re-read the docs on both packages and modules today, got some ideas, but no solution yet! 02:34
what I *wanted* to do is something like write `unit module A;` at the top of every source file belonging in namespace A, `unit module B;` at the top of every source file belonging in namespace B, and `unit module C;` at the top of every source file belonging in C 02:35
but this doesnt work if we try to use two of these from somewhere else
greetings folks! I have been growing a raku repository with all source files uniquely named within a single folder. Now, there are many tens of thousands of lines of code and I would like to split everything into separate namespaces! basically, I am wondering what is the most non-invasive way to do this! What do you think? 02:37
basically, in this repository i have three language grammars, actions, and models, spread out over many files for each language. there are probably 30-70 separate files for each separate language 02:38
now, i want to write a script which, for instance, uses the "Identifier" construct from both languages, ie Python::Identifier and C::Identifier in one program 02:39
but the trouble is that nothing is scoped, so I am wondering if I have to change every single call site or invocation for every item across the entire code base, or if there is a way to lift these files into their own separate namespaces uninvasively
ideally I could just make folders called "Python", "C", etc, sticking the relevant files inside 02:41
I'd like to avoid having to attach a scope to everything defined in the C releated files, and as well at all of the invocations
02:48 frost joined
ideally I could just make folders called "Python", "C", etc, sticking the relevant files inside -- then, from the script, I could access them with their namespace as indicated by the directory structure, ie C::Ident, Python::Ident, etc 02:53
maybe it is possible to "augment" a module? then, I could build it over several files, I suppose 02:54
it seems like there must be a better solution than that...
basically, what I want to achieve is analogous to a "namespace" in C++ 02:55
to clarify the problem: 02:58
1) currently, I have one large directory of many raku files
2) these files fall into five categories
---- language model files (grammars, actions, classes) for language A
---- language model files (grammars, actions, classes) for language B
---- language model files (grammars, actions, classes) for language C
---- files with utility functions, functions which invoke the language model files in A, B, or C, string wrangling, etc 03:00
----newly added files which are meant to translate from language A --> B, A --> C, B --> C, etc
3) all files, regardless of category, are in a flat hierarchy in a single directory
4) I have this directory hooked up as my RAKULIB, so from elsewhere all I need to do (generally) is `use filename;` to work with the contents of any of these files 03:02
A---- language model files (grammars, actions, classes) for language A
C---- language model files (grammars, actions, classes) for language C
B---- language model files (grammars, actions, classes) for language B
D---- files with utility functions, functions which invoke the language model files in A, B, or C, string wrangling, etc
E----newly added files which are meant to translate from language A --> B, A --> C, B --> C, etc
2) these files fall into five categories (A,B,C,D,E)
A---- language model files (grammars, actions, classes) for language A
5) now, in category E, I need to use files from both A and B, for example. Unfortunately, I am now hitting conflicts between identically named constructs in languages A and B 03:04
(ie, "Identifier")
3) all files, regardless of category, are currently in a flat hierarchy in a single directory
to me, it makes sense (from files in category E) to call these "LanguageA::Identifier", and "LanguageB::Identifier" 03:06
it does not make sense to me to need to call the Identifier "LanguageA::Identifer" from within one of the LanguageA files
from one of the LanguageA files, I'd like to call it simply "Identifier"
to me, this seems like the situation a Raku "Module" is meant to address 03:07
So now, my question is: ***how do I get it so that all of the files in LanguageX are together in one raku module, without having to destroy their current organization into separate source files?" 03:08
It seems I cannot write ```raku 03:12
module LanguageA {
#language-a-file-contents
}
```
It seems I cannot write ```raku 03:13
module LanguageA {
#language-a-file-contents
}
```
to wrap around each file for LanguageA, because this creates many separate modules all named LanguageA (and thus we get conflicts)
maybe I can put them all in separate directories and somehow expose their contents to the outside world? how would this be done? Is it possible to have one raku source file expose the contents of several other raku source files to whoever uses it? 03:14
03:25 Guest35 left
here is basically the error^ 03:33
I'd like to be able to have *one module* over several source files, basically
oh wait! got it! wow nice! 03:39
it looks like I can use packages for this purpose! (instead of modules)
great!
maybe this information will help somebody else here too!
bye!
03:57 frost left
Now I am running into a different problem -- suppose I have the following: ``` 04:47
unit package A;
our class ItemX::SubItem is export {}
our class ItemY::SubItem is export {}
```
I get the error: `a symbol SubItem has already been exported`
shouldn't this usage be allowed?
06:08 curious joined, curious left
I think I am able to figure it out -- I just remembered that there are loads of great projects online which can show how to properly structure a complex codebase 😁 06:39
07:20 Util left, Util joined 07:31 frost joined 08:08 dakkar joined 10:48 zacts joined 11:16 zacts left 11:35 frost left 11:47 frost joined 11:57 frost left 12:45 Guest35 joined 13:09 frost joined 14:31 frost left 16:35 dakkar left 20:25 hhcryfqnut joined 20:50 hhcryfqnut left