[MLton] SML/NJ deviation: rebinding ref
Andreas Rossberg
AndreasRossberg at web.de
Tue Aug 15 01:58:39 PDT 2006
"Vesa Karvonen" <vesa.karvonen at cs.helsinki.fi>:
>
> Done. I was curious and tried the other illegal rebindings (true, false,
> nil, and ::) listed on page 9 of the Definition. They are all allowed
> in SML/NJ (at least in v110.59 without further configuration). So,
> SML/NJ is consistent in this respect.
>
> BTW, is there a good reason to prevent rebinding those identifiers?
I reckon it's mainly for the sake of keeping the language spec simple. Parts
of the Definition refer to these identifiers literally (e.g. the Dynamic
Semantics and the definition of Derived Forms). You would need to introduce
some extra indirections or handwaving if they were allowed to be shadowed
(or live with context-dependent meaning and validity of derived forms). In
the case of ref, its meaning even is hardwired into the dynamic semantics.
Without further measures, allowing to rebind it would indeed make the
respective rules unsound.
- Andreas
More information about the MLton
mailing list