-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)modules
Milestone
Description
const
can cause serious, subtle bugs when combined with precompilation. it is valid to use from the :toplevel
scope, but it can cause problems if used at runtime (and it's already ignored when specified at the local scope. this could be fixed by warning for and ignoring the const declaration outside of the toplevel scope. or this could be fixed by internally distinguishing between const
(as it is currently defined) and a new assigned once
attribute (that provides none of the inference speed benefits of const, but just doesn't allow reassignment).
the following is fine:
module Fine
const binding = value
end
the following can confuse precompilation (and isn't great for type inference either):
module Bad
__init__() = (global const binding = value)
end
the following currently is ignored by parsing, so is neither bad nor good:
module Either
f() = (const localb = localv)
end
Metadata
Metadata
Assignees
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)modules