2015-12-08 17:44 GMT+01:00 Marcus Denker <marcus.denker@inria.fr>:
Yes, I wondered why it was not done in semantic analysis⦠would be much easier.
The binding approach only takes care of reflective change (Smalltalk globals at: Object put: nil), a case that is not as important to fix. (reflection is dangerous, disallowing just this one operation does not help).
We should do some experiments.
by the way, what is the difference between LiteralVariable : isGlobal and isGlobalVariable ?
Marcus
On 08 Dec 2015, at 17:33, Guillermo Polito <guillermopolito@gmail.com> wrote:
I remember. But what I do not remember is if the compiler was aware of it.
I remember you had these ReadOnlyVariable, subclass of association that redefined #value:. You were however still capable of doing:
MyReadOnlyVar := 1.
On 8 dic 2015, at 5:29 p.m., Marcus Denker <marcus.denker@inria.fr> wrote:
Hi,
There used to be a mechanism for that (readonly variable bindings).
It was there but not used: half the globals where readonly, all globals added after the experiment was done where ânormalâ.
With the new âfirst classâ variables we could easily add that back in a clean way.
Marcus
On 08 Dec 2015, at 17:19, Nicolai Hess <nicolaihess@gmail.com> wrote:
Object := nil
you can evaluate that piece of code, but afterwards ....
Opal checks for assignments to read only variables (method arguments for example) and signals an error if you try to modify those vars. But it does not check globals.
Should all Globals (OCLiteralVariable with isGlobalVar == true) be read only ? or can we distinguish global vars and class bindings?