gm2
[Top][All Lists]
Advanced

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

[Gm2] Another one, type and type equivalence stuff...


From: Dragiša Durić
Subject: [Gm2] Another one, type and type equivalence stuff...
Date: Thu, 29 Jul 2010 21:29:38 +0200

% gm2 -I. -fiso -c TestCase5.mod
TestCase5.mod:25:3: error: type incompatibility found between types 'INTEGER' 
and 'My' during an assignment, hint maybe the expression should be converted
TestCase5.mod:26:3: error:  'cmp' is not recognised as a procedure, check 
declaration or import
TestCase5.mod:22:3: error:  'cmp' is not recognised as a procedure, check 
declaration or import

What can be interesting, XDS groks it.
% ../xds/bin/xc "=compile" TestCase5.mod
XDS Modula-2 v2.40 [x86, v1.50] - build 10.05.2005
Compiling "TestCase5.mod"
no errors, no warnings, lines   29, time  0.01
=========
MODULE TestCase5;

FROM
  SYSTEM
IMPORT
  ADDRESS;

TYPE
  Compare = PROCEDURE (ADDRESS, ADDRESS): INTEGER;
  My = Compare;

PROCEDURE MyCmp(arg1, arg2: ADDRESS): INTEGER;
  BEGIN
    IF arg1 = arg2 THEN
      RETURN -1;
    ELSE
      RETURN 0;
    END;
  END MyCmp;

VAR
  cmp: My;
  a, b: ADDRESS;
BEGIN
  cmp := MyCmp;
  IF cmp(a, b) > 0 THEN
    a := b;
  END;
END TestCase5.

-- 
Dragiša Durić <address@hidden>




reply via email to

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