Constants with type declarations #13443
Labels
help wanted
This issue is generally accepted and needs someone to pick it up
kind:feature
topic:lang
This is not allowed:
I think it should, because this allows constant initializers to use autocasting. In this case
FOO = 0_i64
would also suffice, but things change when the integer type does not have a fixed size, e.g. it is platform-specific:It is better than the following:
because it is easier for the compiler to infer in the first case that
FOO
is a compile-time constant and skip the generation of the run-time initializer (~FOO:init
here).Naturally this would allow
Crystal::Macros::TypeDeclaration#var
to be aPath
node. Constant declarations with a type and without an initializer would still be disallowed, unless we further define them like in #14085 (comment).The text was updated successfully, but these errors were encountered: