Open mimoo opened 1 year ago
I think the downside is not significant enough for a change now, but I could see that change happening in the future if we want to be more efficient.
An uppercase might also not be the best way to detect constants. Perhaps we should reserve the const::*
namespace for defining constants. And we could have something like:
cst {
thing = 3;
thing2 = Thing { ... };
}
// ...
cst::thing
PS: I should add this to the book
const vars are defined at the top of a module like so:
they currently don't need to be uppercase because I deemed that it was not necessary. But:
ExprKind::Variable
in the AST.The second design decision means that:
ExprKind::Variable
must carry aModulePath
which indicates from which module they are from, even though only const vars can be from a different module. That's a bit annoying.