Closed apblack closed 4 years ago
I recall @kjx arguing that true
and false
are just def
ined identifiers, and that, in principle, a user could redefine them. Indeed, minigrace takes care to allow user-defined "truthy" and "falsy" values that have the type, and behaviour, of true
and false
, while (potentially) having other behaviours as well. (See, for example, _t157_truthytest.grace).
If a teaching dialect wants to prohibit re-declaration of true
and false
, then it can of course do so.
So, I'm going to close this issue: true
and false
are intentionally not reserved, as it says in the specification.
According to the spec,
true
andfalse
are not reserved words. Is this what we want?The effect of this is to imply that
true
andfalse
are defined in the standardGrace dialect, and they could be redefined by a programmer in an inner scope to be something else. They could also be given another meaning in another dialect.This could even be useful, but I think that it's more likely to be dangerous.
minigrace treats
true
andfalse
specially, to stop them from being redefined. I did this after seeing students assigning toself
. I suspect that the spec should simply say thattrue
andfalse
are amongst the reserved tokens, but wanted to check whether the current situation was intentional or not.