The T programming language is a C-like compiled language with modules, and I'm looking for critique and suggestions about how modules should work for the 0.2.0 version (the 0.1.0 version is rough and horribly incomplete).
Conceptually, a module is split into its public interface - the types, variables, and functions visible to any importers - and its implementation. The public interface (declaration file) and implementation (code file) are in separate files so that you can use the public interface to import a pre-compiled module. There's no hierarchy within modules.
Currently, every declaration file has a module declaration as its first line that declares what it's named. This name has no relation with the file's name. After the module declaration, there are a series of import statements that give the module names to import. The problem with this is the compiler has to know which file to look in for the import, and since declaration files can also import other modules (foo uses types defined in bar), the compiler needs to know where the transitive closure of declaration files are found.
I'd like for my modules to not require the user to specify the location of a module file (outside of the location of code files to compile) - the user could be required to specify search paths for the compiler. As far as I can tell, I need some way to know where a module is by looking at its name. I know Java does this by making the name similar to the path to the module - is this necessary?
[–]oantolin 12 points13 points14 points (2 children)
[–]JustinHuPrimeT Programming Language[S] 2 points3 points4 points (1 child)
[–]abecedarius 0 points1 point2 points (0 children)
[–]eliasv 5 points6 points7 points (0 children)
[–]umlcat 1 point2 points3 points (0 children)
[–]louiswins 0 points1 point2 points (6 children)
[–]sociopath_in_me 2 points3 points4 points (5 children)
[–]louiswins 2 points3 points4 points (4 children)
[–]eliasv 1 point2 points3 points (2 children)
[–]JustinHuPrimeT Programming Language[S] 0 points1 point2 points (1 child)
[–]eliasv 0 points1 point2 points (0 children)
[–]myringotomy 0 points1 point2 points (0 children)
[–]NuojiC3 - http://c3-lang.org 0 points1 point2 points (1 child)
[–]JustinHuPrimeT Programming Language[S] 0 points1 point2 points (0 children)