Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!pa.dec.com!src.dec.com!Thomas Roemke From: modula-3@uni-paderborn.de (Thomas Roemke) Newsgroups: comp.lang.modula3 Subject: Local procedure assignment (Bug in M3 1.6 SPARC)? Message-ID: <9104101603.AA06880@thor.uni-paderborn.de> Date: 10 Apr 91 16:22:10 GMT Lines: 43 To: m3 X-Mailer: ELM [version 2.3 PL11] Assigning a local procedure is illegal. In the case of procedure variables the compiler has to generate code for verifying this at runtime. The pro- gram below has to raise an exception (or just terminate execution??), since the second assignment to x is illegal (i.e. a local procedure). Am I right ? MODULE LProcAssign EXPORTS Main; VAR x: PROCEDURE (); PROCEDURE q(p: PROCEDURE (); b: BOOLEAN := TRUE) = PROCEDURE z() = BEGIN END z; BEGIN x := p; (* runtime check (b = FALSE => runtime error) *) IF b THEN q(z,FALSE); (* correct, local z *) END END q; PROCEDURE z() = BEGIN END z; BEGIN q(z); (* correct, global z *) END LProcAssign. Thomas -- (* Thomas Roemke, University of Paderborn, Germany modula-3@uni-paderborn.de ..!uunet!mcsun!unido!pbinfo!modula-3 *)