Path: utzoo!attcan!uunet!mcvax!ukc!dcl-cs!aber-cs!pcg From: pcg@aber-cs.UUCP (Piercarlo Grandi) Newsgroups: comp.lang.c++ Subject: Re: goodbye cpp ??? (macros vs. inline functions) Summary: cpp is good for SYNTAX extension... Message-ID: <265@aber-cs.UUCP> Date: 24 Nov 88 14:38:03 GMT References: <6590072@hplsla.HP.COM> <1757@dataio.Data-IO.COM> <3637@pt.cs.cmu.edu> <1304@cod.NOSC.MIL> <12903@duke.cs.duke.edu> Reply-To: pcg@cs.aber.ac.uk (Piercarlo Grandi) Distribution: eunet,world Organization: CS Dept., University College of Wales, Aberystwyth, UK Lines: 39 X-Disclaimer: Any statement is purely personal. In article <12903@duke.cs.duke.edu> crm@romeo.cs.duke.edu (Charlie Martin) writes: I want to throw in one quibble into the discussion of eliminating cpp. Several people have suggested that eliminating cpp would mean giving up conditional compilation, and I want to point out that this just isn't so. There is no reason why the scanner can't handle conditional compilation as well, just as comments are handled. Yes, but there is an important area where a macroprocessor is essential, and is in defining new syntax. I have a custom, when defining a new data structure such as a list, to provide a for-like new statement that scans it; I have an habit to define other innocent syntax extensions, such as new constructs for recursive descent parsing, or for state machines. If lightly used, and discreet, syntax extensions can be extremely helpful in making the program more readable. There is a big danger here that syntax extensions be used to make programs even more unreadable and unfamiliar; most people agree that the original Bourne shell source, where Steven Bourne tried to recreate the looks of his beloved Algol68C, was not a good idea. I believe that they have a role when they are used to abstract from the gritty detail, without trying to later dunamentally the nature of the language they apply to. On the other hand I do really believe that cpp in C++ is not that useful; #include's should be done with import/export, for example, and definitions can be done with inlines and consts, and conditional compilation can be done most often by a suitable constant expression in a if; as to syntax extensions, I think something like ML/1 would be the ideal thing here. -- Piercarlo "Peter" Grandi INET: pcg@cs.aber.ac.uk Sw.Eng. Group, Dept. of Computer Science UUCP: ...!mcvax!ukc!aber-cs!pcg UCW, Penglais, Aberystwyth, WALES SY23 3BZ (UK)