Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!mimsy!dftsrv!ames!amdcad!sun!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.c++ Subject: Re: goodbye cpp ??? (macros vs. inline functions) Message-ID: <822@quintus.UUCP> Date: 7 Dec 88 21:00:02 GMT References: <3637@pt.cs.cmu.edu> <6590076@hplsla.HP.COM> <588@auspex.UUCP> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 29 In article <588@auspex.UUCP> guy@auspex.UUCP (Guy Harris) writes: >There is some precedent, if I remember correctly, for language features >that can be considered to affect the source code seen by the "real" >compiler. I think PL/I provide (more-or-less) equivalent capabilities, PL/I "compile-time statements" (the facility was commonly called the preprocessor...). E.g. % DECLARE EXPR CHARACTER; % EXPR = '(FOO*BAZ)'; is like #define EXPR (FOO*BAZ) % FN: PROCEDURE (X, Y) RETURNS CHARACTER; DECLARE (X, Y) CHARACTER; RETURN ('F(' || X || ',' || Y || ',' || X || ')'); % END FN; is like #define FN(X,Y) F(X,Y,X). Compile-time variables don't have to act as macros. There are compile-time %IF and %DO statements, even labels and % GOTO. Burroughs Extended Algol had a similar feature, using apostrophe as the prefix for compile-time statements. This was in addition to $INCLUDE and DEFINE. Preprocessor variables could be arrays. The language SAIL also provides similar features, described in TOPLAS some years ago. The interesting thing about these three is that to the best of my knowledge all three were implemented using coroutines.