Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!f.gp.cs.cmu.edu!rpd From: rpd@f.gp.cs.cmu.edu (Richard Draves) Newsgroups: net.lang.mod2 Subject: Re: Single Pass Modula-2 Compiler Message-ID: <8@f.gp.cs.cmu.edu> Date: Wed, 8-Oct-86 02:30:15 EDT Article-I.D.: f.8 Posted: Wed Oct 8 02:30:15 1986 Date-Received: Wed, 8-Oct-86 08:19:58 EDT References: <12243102365.25.KURKURE@Sushi.Stanford.EDU> <841@cuuxb.UUCP> Organization: Carnegie-Mellon University, CS/RI Lines: 23 In article <841@cuuxb.UUCP> mwm@cuuxb.UUCP (Marc W. Mengel) writes: > Actually, you can note the fact that whatever type the symbol has > must be compatable with how it is being used, and check that against > the actual declaration when you see it. For example, if I see a > function call: > > intvar := funct( 5.0, "test", 7 ); > > I can note that funct must return a type that can be assigned to an int, > and accept a floating point, char array, and integer argument; then, > when I see a declaration of funct, I can check against this usage, and > determine whether the previous usage was correct. While this may seem > to be a lot of bookkeeping, it seems to me the gains in speed for a > one pass compiler are sufficient to warrant it. I may also need to > back-patch some appropriate type conversions (i.e. integer->real, etc.). And what if it turns out that funct is really a type, and that statement should have been flagged as a syntax error? I think that if you really look carefully at what your proposal would do to calling sequences, and the amount of backpatching that would be needed, you'll agree that it's impractical at best. Rich