Open Akuli opened 1 year ago
Maybe
constant global variable = x
But I think we can use static
keyword to mean this is a global constant or create a new one?
(I think it is not a good idea to use a long keyword
Why is it not a good idea to use a long keyword? An advantage with globalconstant
is that it's unlikely someone wants to make a variable named globalconstant
. But I could imagine someone making a variable named constant
.
We could also try const
, which would be good because it's consistent with many other languages.
Just think long keyword will make people feel annoying. As you say, jou is a simple programming language, why don’t you use a shorter keyword? :)
I think const foo = 123
is pretty good.
I think so.
In C you would use
#define
to create constants. What should be the recommended way in Jou? Should we add new syntax, something likeglobalconstant FOO = 1
?I think currently the best you can do is a function that returns the value, because global variables cannot have an initial value yet. This is actually what
config.jou
does (see the Makefiles).