Discussion:
Oberon-07 question
(too old to reply)
nojb
2010-08-07 16:56:20 UTC
Permalink
Hello,

In Oberon-07 report, it is not clear to me whether

MODULE M;
IMPORT A := B;
BEGIN
B.F
END M.

is allowed?

(I don't have a compiler at hand to try this)

Thanks!
N
Chris Burrows
2010-08-08 01:37:49 UTC
Permalink
Post by nojb
Hello,
In Oberon-07 report, it is not clear to me whether
MODULE M;
IMPORT A := B;
BEGIN
B.F
END M.
is allowed?
No. The statement B.F will result in a compile-time error. You must access
procedure F in module B by its aliased identifier A.F. If you want to access
an imported procedure using the original module name as well as the aliased
name include the module name on the import list twice:

MODULE M;
IMPORT A := B, B; (* or IMPORT B, A := B; *)
BEGIN
B.F;
A.F
END M.

Note that the following is also allowed:

MODULE M;
IMPORT A := B;
VAR
B: RECORD F: PROCEDURE END;
BEGIN
B.F
END M.

i.e. the aliased IMPORT of B does not result in a name clash when B is
defined in the client module.

Regards,
Chris Burrows

CFB Software
ARM Oberon-07 Development System
http://www.astrobe.com

Continue reading on narkive:
Loading...