[Oberon] Please explain syntax

Duke Normandin dukeofperl at ml1.net
Mon Jan 10 19:24:33 CET 2011


On Mon, 10 Jan 2011, Nemo wrote:

> On 10 January 2011 11:45, Duke Normandin <dukeofperl at ml1.net> wrote:
> > hi ....
> >
> > The following is an excerpt from the obc compiler module "Args".
> >
> > (** GetArg -- fetch an argument into a string buffer *)
> > PROCEDURE GetArg*(n: INTEGER; VAR s: ARRAY OF CHAR) IS "Args_GetArg";
> >                                                     ^^^^^^^^^^^^^^^^
> > "IS" is a type-checking relational operator, is it not? So what is it
> > saying here at the end of a procedure declaration?
>
> Vide http://spivey.oriel.ox.ac.uk/corner/Design_overview_for_OBC#Native-code_primitives
> , specifically the fifth paragraph, quoted below.
>
>
> As an example of a library procedure, let's define a procedure Sin,
> which computes the sine of its floating-point argument using the sin
> routine from the C library; essentially the same procedure is already
> provided by the standard Math module. In order to make this new
> primitive available in the rest of an Oberon program, it must be
> declared at the Oberon level; that is the purpose of the following
> declaration, which might appear in the module \fn{MyMath.m}:
>
> PROCEDURE Sin(x: REAL): REAL IS "MySin";
>
> This declaration declares Sin as a procedure, and announces that its
> body will be the C function MySin. The procedure Sin may be used in
> the Oberon code exactly as if it were an ordinary procedure written in
> Oberon. The procedure could also be exported from the MyMath module:
> then other modules that call |MyMath.Sin| would do so in exactly the
> same way as if it were an ordinary bytecode procedure.

Thank you Nemo! for the link and the explanation ...
-- 
Duke



More information about the Oberon mailing list