Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!husc6!endor!draves From: draves@endor.harvard.edu (Richard Draves) Newsgroups: net.lang.mod2 Subject: One-pass Modula-2?? Message-ID: <80@husc6.HARVARD.EDU> Date: Sun, 27-Jul-86 16:25:38 EDT Article-I.D.: husc6.80 Posted: Sun Jul 27 16:25:38 1986 Date-Received: Sun, 27-Jul-86 21:11:25 EDT Sender: news@husc6.HARVARD.EDU Reply-To: draves@endor.UUCP (Richard Draves) Distribution: net Organization: Aiken Comp Lab, Harvard Lines: 44 I don't believe a (reasonable) one-pass compiler for Modula-2 is possible. The reason is that identifiers used in statements may be declared anywhere in the containing scopes, above or below. In particular, forward declarations are no longer necessary because you can use a procedure before declaring it. The problems this causes for calling sequences can be overcome with difficulty. However, it does get worse. Consider: MODULE test; TYPE type = INTEGER; PROCEDURE outer(); PROCEDURE inner(); VAR var: type; BEGIN var := type(0) (* this is incorrect!! *) END inner; TYPE type = REAL; BEGIN END outer; BEGIN END test. References to non-local variables also can't be trusted. What I find particularly despicable about this "feature" is that PROCEDURE inner looks perfectly correct if one doesn't examine its surrounding context. I think this violates the spirit of static scoping in a big way. Rich "a picture in the head is a gory murder in an art gallery" -- Stephen Kosslyn