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
julia> function f()
const a = 1;
a = 2;
return a;
end
f (generic function with 1 method)
julia> f()
2
Although it is not that important for the compiler/optimizer to declare a local constant variable as it can probably figure out itself, it is still useful as a hint/constraint for the user to avoid stupid error or breakage sometimes.
IMHO, as long as local const variable is a valid syntax, it should at least give a warning if the value/binding changes (just as the global one). It might even make sense to be more restrictive and make that an error instead of a warning.
The text was updated successfully, but these errors were encountered:
Although it is not that important for the compiler/optimizer to declare a local constant variable as it can probably figure out itself, it is still useful as a hint/constraint for the user to avoid stupid error or breakage sometimes.
IMHO, as long as local const variable is a valid syntax, it should at least give a warning if the value/binding changes (just as the global one). It might even make sense to be more restrictive and make that an error instead of a warning.
The text was updated successfully, but these errors were encountered: