[Oberon] Question about Oberon semantics of VAR parameters
joerg.straube at iaeth.ch
Sat Dec 7 01:17:28 CET 2019
FrameMsg is the base type of ViewerMsg or in other words ViewerMsg is an extension of FrameMsg.
All extensions are assignment compatible to the base type
> Am 07.12.2019 um 00:33 schrieb "rochus.keller at bluewin.ch" <rochus.keller at bluewin.ch>:
> Can someone please explain to me why the following code in the module display of the Oberon system does not cause a compiler error.
> On line 38 there is the statement "v.handle(v, M)" with "handle" being of procedure type "PROCEDURE (F: Frame; VAR M: FrameMsg);" with "FrameMsg = RECORD END;" and the actual parameter M has the following type:
> ViewerMsg* = RECORD (Display.FrameMsg)
> id*: INTEGER;
> X*, Y*, W*, H*: INTEGER;
> state*: INTEGER
> Since FrameMsg and ViewerMsg are not related and the formal and actual parameter M are not the same according to the Oberon-07 language report and "Programming in Oberon" (2004 edition) I would expect an error, but the compiler accepts it. This is just one of many similar examples. Do I completely misinterpret both documents or is the implemented one actually different from the specified language?
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
More information about the Oberon