-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Are import statements allowed anywhere in a module (like other declarations)? Or must they come at the beginning of a module?
I think that import statements must come at the start of the module, after dialect statements, but before any other statements or declarations. This is for readability, and also to make it easier for the compiler or IDE to collect all of the dependencies and perform a topological sort on them.
Right now, minigrace does not require that imports come at the start of the module. However, the spec says: "Modules may begin with one or more import moduleName as nickname statements" and (in the section on Dialects) "A module may begin with a dialect statement dialect "name" ...". These statements could be clearer: in particular, it makes sense to require that dialect, if present, comes first.