Conversation

how do languages which allow multiple (nested) modules in a single file deal with imports, and relating module names to file paths? e.g. if you have modules A & B with A containing B, is B available (if exported) as A.B? what if src/A/B.blah exists too?
13
12
The trick is to embrace modules != files != compilation units. And ideally get rid of files entirely. Weirdly, one of the things I think Java did very right was to have the definition of "how do I import this?" be independent of the filesystem location.
4
11
Yeah, that’s exactly what I’m aiming for. That said, there are convenient aspects to how e.g. ghci loads files on demand without requiring you to specify all of them which I’d like to support.
1
1
(To be clear, I’m not particularly intending to store code in weird places myself, but rather I think modules and files are orthogonal tools for program organization and that should be the programmer’s business.)
2
1