Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Enable default module.ceylon (review only) #4128

Open
CeylonMigrationBot opened this issue Jul 14, 2014 · 7 comments
Open

Enable default module.ceylon (review only) #4128

CeylonMigrationBot opened this issue Jul 14, 2014 · 7 comments

Comments

@CeylonMigrationBot
Copy link

[@akberc] This pull request is just for review and discussion. Default module with name "default" with package "" seems to compile and run fine, with no detrimental effect on existing compilation or compilation of default module without module.ceylon:

module  { // no name, it is parsed to "default/unversioned"
    import ceylon.collection "1.1.0";
}

package;  // no name, it is parsed to ""

Although the compilers compiles the default module with module.ceylon and package.ceylon fine without imports, it does not add dependencies to the module annotation, although they are present in the typechecker. Some additional errors are also thrown.

[Migrated from ceylon/ceylon-spec#1022]

@CeylonMigrationBot
Copy link
Author

[@lucaswerkmeister] CC #3306, the module { import …; } syntax was suggested there IIRC – or did you come up with it independently? (Either way, it’s a great step towards Scriptable Ceylon IMO.)

@CeylonMigrationBot
Copy link
Author

[@quintesse] @lucaswerkmeister This is just so you can add a module.ceylon file for a default module. I don't think it does much yet to improve scripting. Although being able to import from a default module is a necessary step forward for scripting as well of course.

@CeylonMigrationBot
Copy link
Author

[@lucaswerkmeister] Right, for a script this needs to be allowed in a regular CU (not the three kinds of CU we have today).

@CeylonMigrationBot
Copy link
Author

[@akberc]
@lucaswerkmeister Yes, it is. I have followed #3306 before, but I think it is logical, as the word 'default' should not be in the user vocabulary, but implied, in order to keep the folder structure in sync with the naming. So, souce root = no folder name = no module name = no package name -- as far as the user is concerned. Running it needs 'default'.

@gavinking Does the grammar look OK?, as that will drive the code and testing.

As the language allows multiple type declarations in a source file, is the need for both module.ceylon and package.ceylon a bit overdone? IMHO, the most natural thing would be for a module.ceylon at the root of the module, with an optional package declaration in the same file if needed to share -- otherwise it is the root package. Within the sub-packages, only package.ceylon is possible.

@CeylonMigrationBot
Copy link
Author

[@gavinking] I dunno, I'm not totally convinced that we shouldn't make them write module default { ... }. Can't seem to make up my mind...

@CeylonMigrationBot
Copy link
Author

[@quintesse]

Can't seem to make up my mind...

Writing module default was also the first thing that came into my mind, but I think I prefer @akberc 's version in the end.

@CeylonMigrationBot
Copy link
Author

[@quintesse] @gavinking we never decided what to do with this and has been sitting here for a long time. Don't you think this could be worthwhile?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants