From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8f8cea8602e61aba X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: The Red Language Date: 1997/09/19 Message-ID: #1/1 X-Deja-AN: 273900877 References: <340E2DC5.25D7@worldnet.att.net> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-09-19T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >...but by one pass scheme I would >mean a scheme that operates as follows. > >There is a canonical traversal of the operator tree which visits nodes >one by one and assigns types to each node at the time they are visited. Well said. That's what I was *trying* to say. >Any other definition of one pass is unuseful. For example, the more flexible >definition would lead one to consider all compilers one pass because they >only look at the source once, and from then on they are dealing with >auxiliary data structures -- not a useful definition. Well, I suppose in the bad old days, a "pass" in a compiler had something to do with reading a representation of the source program from the disk, and writing back a different representation. I agree this is not a useful way to look at it. (I recall using a Pascal compiler that required me to remove the "pass 1" floppy, and insert the "pass 2" floppy, for each compile.) >Note that in Algol-68, which uses operand type overloading only, there is >indeed a one pass algorithm in the sense I define it above. Could you briefly explain the Algol 68 rule? Better yet, tell me where I can get my hands on the manual! I've read stuff *about* Algol 68, but I want to read the actual language definition (which, I understand, is rather tough going). I believe C++ overloading is also one pass. As is Red. Strangely, Red allows overloading of enumeration literals, but not function results. So actually, there's sort of a mini second pass needed in the case of literals, but I'm not sure I'd call that a "pass", since it just goes down one level in the tree. One-pass overload resolution seems really horrible to me. It requires kludgery, in C++, where you have to write the type of a numeric literal as part of the literal (as in 0L, for the literal zero of type long). Imagine how that would work in a language with user-defined numeric types. Or user-defined string types, or just 2 built in string types, as in Ada 95. - Bob