[Oberon] Please explain syntax

Nemo cym224 at gmail.com
Mon Jan 10 18:31:43 CET 2011


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.



More information about the Oberon mailing list