Currently there's no way to reference them, because bare names are variables. You could add a prefix to mean a constant like Snowscript does, which has !FOO_BAR translate to PHP FOO_BAR.
But here's a more radical and perhaps nicer idea: Why not just make entirely uppercase names be constants? So if I want to check against INF, I could do if foo != INF. The main downside here is it might not be obvious if you didn't know the rule, and it'd stop you from dealing with projects that use $UPPERCASE_GLOBALS - but those projects probably suck.
This does also raise a problem of how to declare them. You could make FOO = 3 implicitly be a constant declaration, or you could have const FOO = 3 like PHP. I'm not sure which is nicer.
Currently there's no way to reference them, because bare names are variables. You could add a prefix to mean a constant like Snowscript does, which has
!FOO_BAR
translate to PHPFOO_BAR
.But here's a more radical and perhaps nicer idea: Why not just make entirely uppercase names be constants? So if I want to check against INF, I could do
if foo != INF
. The main downside here is it might not be obvious if you didn't know the rule, and it'd stop you from dealing with projects that use$UPPERCASE_GLOBALS
- but those projects probably suck.This does also raise a problem of how to declare them. You could make
FOO = 3
implicitly be a constant declaration, or you could haveconst FOO = 3
like PHP. I'm not sure which is nicer.