You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 importmoduleNameasnickname 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.
The text was updated successfully, but these errors were encountered:
On Sun, Dec 17, 2023 at 4:14 PM Andrew Black ***@***.***> wrote:
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
<https://web.cecs.pdx.edu/~grace/doc/lang-spec/#importing-modules>:
"Modules may begin with one or more import *moduleName* as *nickname*
statements" and (in the section on Dialects
<https://web.cecs.pdx.edu/~grace/doc/lang-spec/#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.
—
Reply to this email directly, view it on GitHub
<#337>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN2D6UD2A4K67HOJFJIGUDYJ6DF5AVCNFSM6AAAAABAYW5I32VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2DKNBUGI3TEMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Prof. Kim Bruce
Computer Science
Pomona College
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, afterdialect
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
moduleNameas
nickname statements" and (in the section on Dialects) "A module may begin with a dialect statementdialect
"name" ...". These statements could be clearer: in particular, it makes sense to require thatdialect
, if present, comes first.The text was updated successfully, but these errors were encountered: