assert is listed as one of the keywords in the grammar, but there appears to be no statement associated with it, and it fails to compile when I try to use it in my expected way.
I've seen it referenced in other discussions. What's the current thinking?
tacticsMon 5 Apr 2010
There are actually a handful of such reserved words:
assert
foreach
void
volatile
The reasoning is pretty simple. These are words we wish to reserve for possible future use. The best example is probably foreach. A foreach construct has proven to be very useful in many languages. We will probably be adding one eventually, but right now, it's not clear how we want to do it. We don't have a collections library, like Java or C#, and until we understand how collections should "work" in Fantom, it's better to make sure no one names their variables foreach or volatile in the meantime.
Other languages do this too. Java, for example, reserves const and goto, but they are not used in the language.
lel4866 Mon 5 Apr 2010
assert is listed as one of the keywords in the grammar, but there appears to be no statement associated with it, and it fails to compile when I try to use it in my expected way.
I've seen it referenced in other discussions. What's the current thinking?
tactics Mon 5 Apr 2010
There are actually a handful of such reserved words:
The reasoning is pretty simple. These are words we wish to reserve for possible future use. The best example is probably
foreach
. Aforeach
construct has proven to be very useful in many languages. We will probably be adding one eventually, but right now, it's not clear how we want to do it. We don't have a collections library, like Java or C#, and until we understand how collections should "work" in Fantom, it's better to make sure no one names their variablesforeach
orvolatile
in the meantime.Other languages do this too. Java, for example, reserves
const
andgoto
, but they are not used in the language.