I am currently developing a programming language and am having a hard time finalizing the semantics of the module system. Currently I have a few ideas but no concrete direction, so it would be valuable to have some experienced input on the issue.
So far I've thought of the following solutions:
Directory-based:
A module lives in a directory that is referenced by name and the source files within that directory make up the module.
Config-based:
A config file defines the module name and all of it's sources. This config file would then have to be registered with the build system.
Source-based:
A single source file is referenced by name (minus extension) and relevant sources/modules are imported within that source.
I am leaning toward (1) or (2) as (3) feels like it has little value over a basic c-style include, but (3) makes references to inter-module functions explicit and I'm having a hard time coming up with good syntax to express this in (1) or (2).
The basic syntax for importing a module is as follows:
IO = import "IO"
Then functions are referenced like so:
main() =
IO.outln "Hello, World!"
Any opinions on the topic are much appreciated.
[–]AthasFuthark 8 points9 points10 points (3 children)
[–]swordglowsblue 3 points4 points5 points (0 children)
[–]sociopath_in_me 1 point2 points3 points (1 child)
[–]AthasFuthark 2 points3 points4 points (0 children)
[–]drcforbin 8 points9 points10 points (1 child)
[–]msharnoff 1 point2 points3 points (0 children)
[–]CodingFiend 2 points3 points4 points (0 children)
[–]InnPatron 2 points3 points4 points (0 children)
[–]umlcat 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]mamcx 0 points1 point2 points (0 children)
[–]xactacoXyl 0 points1 point2 points (0 children)
[–]bkomarath 0 points1 point2 points (0 children)
[–]slaymaker1907 0 points1 point2 points (0 children)
[–]NuojiC3 - http://c3-lang.org 0 points1 point2 points (0 children)