gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with import/export in local modules


From: john o goyo
Subject: Problem with import/export in local modules
Date: Wed, 27 Mar 2024 20:05:18 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

Greetings, Gaius.

The following module fails compilation.


MODULE Test;

PROCEDURE Double(n :CARDINAL) :CARDINAL;
BEGIN
    RETURN 2*n
END Double;

MODULE Inside;

    EXPORT Quadruple;
    IMPORT Double;

    PROCEDURE Quadruple(k :CARDINAL) :CARDINAL;
    BEGIN
        RETURN Double(k) * Double(k)
    END Quadruple;

END Inside;

VAR
    d :CARDINAL;
BEGIN
    d := Quadruple(3)
END Test.


This is a minimal version of a much larger legacy module.  I believe the above to be valid.

The following is the compilation.

=> gm2-git -c Test.mod
Test.mod:12:12: warning: In inner module ": syntax warning, " missing
   12 |     IMPORT Double;
      |            ^~~~~~
Test.mod:19:11: warning: In program module ": syntax warning, " missing
   19 | END Inside;
      |           ^
Test.mod:1:8: error: module name at beginning " does not match the name at end "
    1 | MODULE Test;
      |        ^~~~
Test.mod:9:8: error: In inner module â: module name at beginning " does not match the name at end "
    9 | MODULE Inside;
      |        ^~~~~~
Test.mod:12:5: error: syntax error, found "
   12 |     IMPORT Double;
      |     ^~~~~~
Test.mod:12:12: error: module name at end " does not match the name at beginning "
   12 |     IMPORT Double;
      |            ^~~~~~
Test.mod:19:5: error: In program module ": module name at end " does not match the name at beginning "
   19 | END Inside;
      |     ^~~~~~
Test.mod:19:11: error: syntax error, found "
   19 | END Inside;
      |           ^
Test.mod:29:1: error: no scope active: compilation failed

(I am also mystified by the quotation marks.)

Sincerely,
john




reply via email to

[Prev in Thread] Current Thread [Next in Thread]