[Oberon] Clarifying type compatibility in Oberon-07

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sun Oct 8 11:08:31 CEST 2017

> On Fri Oct 6 15:57:28 CEST 2017 August Karlstrom wrote:
> > On 2017-10-06 12:19, Andreas Pirklbauer wrote:
> > every procedure used as an actual parameter would have to be given an explicit name
> >
> I'm not sure what you mean here. Can you clarify?

It means that the *type* (i.e. the signature) of every procedure would need to get a *type name*, requiring a new syntax (am example is shown below). This was (rightly?) considered to be overkill when Oberon was designed, as most procedures are “standalone" procedures that are not later assigned to a procedure variables.

  TYPE MyProc = PROCEDURE (x, y: INTEGER): INTEGER;  (*defines a procedure type (signature)*)
  VAR P: MyProcedure; (*declares procedure variable of the named procedure type ‘MyProc'*)

  PROCEDURE Q: MyProc; (*implements the procedure type ‘MyProc'*)
    VAR i, j: INTEGER;
  END Q;

  P := Q; (*assigns an implementation to a procedure variable*)


PS: If you are familiar with other strongly typed languages, you may have come across roughly similar constructs in other contexts. For example, in ‘Go’ there are ‘interface types’, or in Swift there are ‘protocols’ (to which classes are said to “conform”). Translated to our discussion one could say that “P conforms to signature MyProc” and “Q conforms to AND implements MyProc").

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20171008/38ecc9d7/attachment.html>

More information about the Oberon mailing list