gm2
[Top][All Lists]
Advanced

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

proctype and procedure type checking fully implemented


From: Gaius Mulley
Subject: proctype and procedure type checking fully implemented
Date: Sat, 20 Apr 2024 15:17:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi,

a small note to say that the type checker has been improved to
fully check proctype/procedure combinations.  For example:

$ cat badproccard.mod
MODULE badproccard ;

FROM NumberIO IMPORT WriteCard ;
FROM StrIO IMPORT WriteString, WriteLn ;

PROCEDURE func () : CARDINAL ;
BEGIN
   RETURN 42
END func ;

BEGIN
   WriteString ('the value is: ') ; WriteCard (func, 5) ; WriteLn
END badproccard.

$ gm2 badproccard.mod
badproccard.mod:12:48: error: 1st parameter type failure between actual 
parameter type ‘func’ and the formal type ‘x’
   12 |    WriteString ('the value is: ') ; WriteCard (func, 5) ; WriteLn
      |                                                ^~~~
badproccard.mod:12:48: error: procedure type and ‘CARDINAL’ are
incompatible as formal and actual procedure parameters

regards,
Gaius



reply via email to

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