[Oberon] Clarifying type compatibility in Oberon-07

Jörg joerg.straube at iaeth.ch
Sun Oct 8 13:55:36 CEST 2017

If we allow anonymous procedures, you don't have to declare parameters again. They are stated in RealFunction already.
It should be enough to write
  Integral ( RealFunction(RETURN Math.sin(v)), 0.0, Math.pi));


> Am 08.10.2017 um 13:45 schrieb Richard Hable <informujo at aon.at>:
> On 2017-10-08 09:09, August Karlstrom wrote:
>> On 2017-10-08 07:26, Jörg wrote:
>>> PROCEDURE myDot = DotType; (* totally new syntax *)
>> This would be problematic if you want to use an existing procedure, like
>> Math.sin in .e.g. Integral(Math.sin, 0.0, Math.pi).
> The programming language should then support anonymous procedures,
> created e.g. with the following syntax:
> 	ProcedureType (?(parameters) body)
> If the integral procedure was defined like this:
> 	TYPE RealFunction = PROCEDURE (v: REAL): REAL;
> 	PROCEDURE Integral (f: RealFunction; x, y: REAL);
> 	BEGIN ...
> 	END Integral;
> Then, an existing sinus procedure could be called within an anonymous
> procedure passed to the integral procedure:
> 	Integral (RealFunction (?(x) RETURN Math.sin(x)), 0.0, Math.pi)
> If we accept this wrapping overhead, it is not necessary to declare
> named procedure types for all procedures ever written, but only for
> those which are passed around as parameters or stored in variables.
> I do not propose this extension to Oberon, but I use a similar solution
> in my own programming language project to allow flexible functional
> programming without giving up the security of name equivalence.
> Richard
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon

More information about the Oberon mailing list