[Oberon] Fwd: Re: Re: Question about Oberon semantics of VAR parameters
Luca Boasso
luke.boasso at gmail.com
Sat Dec 7 02:34:33 CET 2019
This document might be useful to you:
https://github.com/lboasso/oberonc/blob/master/doc/TypeRules.md
On Fri, Dec 6, 2019, 16:29 rochus.keller at bluewin.ch <
rochus.keller at bluewin.ch> wrote:
> Thanks for your response.
>
> > FrameMsg is the base type of ViewerMsg or in other words ViewerMsg is an
> extension of FrameMsg.
> No, it isn't. It's type definition is "FrameMsg = RECORD END;" as
> mentioned. Only the identifier is the same (whereas in different modules).
> So an actual type with a completely unrelated type is assigned to the
> formal type of the VAR parameter. There are many other examples, some where
> even a record is assigned to a byte array.
>
> Best
> R.
>
> ----Ursprüngliche Nachricht----
> Von : joerg.straube at iaeth.ch
> Datum : 07/12/2019 - 01:24 (CET)
> An : rochus.keller at bluewin.ch
> Betreff : Re: [Oberon] Question about Oberon semantics of VAR parameters
> https://inf.ethz.ch/personal/wirth/Oberon/Oberon07.Report.pdf
> Chapter 9.1, bullet 3
>
>
>
> Jörg
>
>
>
>
> Am 07.12.2019 um 01:17 schrieb Jörg <joerg.straube at iaeth.ch>:
>
>
>
>
>
>
>
> 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
>
>
>
> Jörg
>
>
>
>
> 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
>
>
>
> END;
>
>
>
>
>
>
>
> 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?
>
>
>
>
>
>
>
> Best
>
>
>
> R.
>
>
>
> --
>
>
>
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related
> systems
>
>
>
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
>
>
>
>
>
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20191206/6f282515/attachment.html>
More information about the Oberon
mailing list