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. 

        Marcus

> On 08 Dec 2015, at 17:33, Guillermo Polito <[email protected]> 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 <[email protected] 
>> <mailto:[email protected]>> 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 <[email protected] 
>>> <mailto:[email protected]>> 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?
>>> 
>> 
> 

Reply via email to