Oberon Community Platform Forum

Development => ETH Zonnon => Topic started by: ceekay73 on August 27, 2013, 01:50:25 PM



Title: Zonnon 1.3.0.0 access modifier question
Post by: ceekay73 on August 27, 2013, 01:50:25 PM
while this works fine under Oberon-2 (with records), i have a problem understanding Zonnon's behavior.
small module:
>>>
module RecTst;

type {public} innerst = object
   var {public}
      one : integer{32};
end innerst;

type {public} inner = object
   var {public}
      inrst : innerst;
      two : integer{32};
end inner;

type {public} outer = object
   var {public}
      inr : inner;
      three : integer{32};
end outer;

var {public, immutable}
   otr : outer;

begin
end RecTst.
<<<

even though otr is exported as immutable, the following compiles and executes in a Main module:
>>>
module Main;

import RecTst;

begin;
   RecTst.otr.three := 3;
   RecTst.otr.inr.two := 2;
   RecTst.otr.inr.inrst.one := 1;
end Main.
<<<

shouldn't the write access be prevented by exporting otr as immutable?

thanks a lot and with kind regards,
Christian.