shankar@hpclscu.HP.COM (Shankar Unni) (12/08/88)
One thing that pisses me off about the Extended Pascal standard is that there has been *NO ATTEMPT* to standardise at least a SYNTAX for pragmas within the source. Never mind implementing a few like "include" and "if/ifdef" (can you see my C bias showing through?) Both INCLUDE's and IF/IFDEF's are ESSENTIAL for any program that must be targeted at widely different machines. Now don't get me wrong: I'm not saying that it is impossible to do so (I've heard all the arguments about "isolating system-dependent code in modules of their own and re-writing them for different systems"), but still, for convenience and efficiency, there is no beating conditional compilation. There are also other applications for conditional compilation. Both of my previous projects (one in Pascal (Pascal compiler) and one in C (C compiler :-)) were being enhanced. While the enhancement process was going on, we had to keep producing versions of the old product. The only reasonable way to do this was conditional compilation ( #ifdef ANSI code for handling ANSI C features... #endif ) Can you do *this* using Extended Pascal? You see, every vendor is going to implement pragmas in their compiler. Let's not bury our heads like Ostriches and pretend that the problem doesn't exist. At the very least, let's design a syntax for pragmas in Extended Pascal. HERE'S ONE VOTE FOR CPP!! --- Shankar (ex-Pascal hack) Unni.
rang@cpsin3.cps.msu.edu (Anton Rang) (12/09/88)
In article <950013@hpclscu.HP.COM>, shankar@hpclscu.HP.COM (Shankar Unni) writes: >Both INCLUDE's and IF/IFDEF's are ESSENTIAL for any program that must be >targeted at widely different machines. Now don't get me wrong: I'm not >saying that it is impossible to do so (I've heard all the arguments about >"isolating system-dependent code in modules of their own and re-writing >them for different systems"), but still, for convenience and efficiency, >there is no beating conditional compilation. I agree that include files are nice. However, they shouldn't be necessary if modules are correctly supported (well, correctly in my opinion :-). Check out the VAX Pascal [ENVIRONMENT] and [INHERIT] mechanism for a good example of this. (Besides getting rid of nasty source-changing pragmas, they save the compiler from doing all the work of parsing etc. twice.) I'm not sure that IF/IFDEF is necessary at a source level. What's wrong with just using something like: const doing_ansi = false; ... if doing_ansi then begin { do ansi stuff } end; (Of course, you could pick some convention for distinguishing these constants from ordinary variables: capital letters, for instance.) I've used this in a number of my programs; any modern compilers should eliminate the dead code. (All the ones I use do.) Anton +---------------------------+------------------------+----------------------+ | Anton Rang (grad student) | "VMS Forever!" | "Do worry...be SAD!" | | Michigan State University | rang@cpswh.cps.msu.edu | | +---------------------------+------------------------+----------------------+
andru@rhialto.SGI.COM (Andrew Myers) (12/10/88)
In article <950013@hpclscu.HP.COM>, shankar@hpclscu.HP.COM (Shankar Unni) writes: > One thing that pisses me off about the Extended Pascal standard is that there > has been *NO ATTEMPT* to standardise at least a SYNTAX for pragmas within > the source. Never mind implementing a few like "include" and "if/ifdef" (can > you see my C bias showing through?) > > Both INCLUDE's and IF/IFDEF's are ESSENTIAL for any program that must be > targeted at widely different machines. Now don't get me wrong: I'm not > saying that it is impossible to do so (I've heard all the arguments about > "isolating system-dependent code in modules of their own and re-writing > them for different systems"), but still, for convenience and efficiency, > there is no beating conditional compilation. The Silicon Graphics version of Pascal (an implementation of the ANSI standard) is, by default, run through cpp before the parser gets its hooks into the source code. Even if you don't have this feature on the system you're using, but do have UNIX, you can still use cpp in conjunction with sed to achieve the same effect. What's the problem? And as Anton Rang pointed out, modern compilers eliminate dead code, so you can use boolean constants in place of clunky ifdefs without performance degradation. Andrew
bobd@ihf1.UUCP (Bob Dietrich) (12/13/88)
In article <950013@hpclscu.HP.COM> shankar@hpclscu.HP.COM (Shankar Unni) writes: >One thing that pisses me off about the Extended Pascal standard is that there >has been *NO ATTEMPT* to standardise at least a SYNTAX for pragmas within >the source. Never mind implementing a few like "include" and "if/ifdef" (can >you see my C bias showing through?) >... Sure do. >--- >Shankar (ex-Pascal hack) Unni. Sorry, but you're wrong. JPC DID try to standardize on pragmas, but could not come to a consensus position. So it was left out. Both a generalized mechanism and an include-only mechanism were considered. There were various problems that were encountered. The first is that existing practice varies so widely, someone's toes were going to get mashed. Many hours were spent arguing over what character(-sequence) should start a pragma, because no matter what you picked, one or two people would be happy and the rest would have to go home and change code. Note that standardization means coming to a consensus position, not a unanimous position, and we couldn't even achieve that. Other languages that have been primarily sponsored by a single company or agency do not have such a problem, by definition. Another problem was how to define the facility in the standard, with results similar to the first. As the existing Pascal standard is defined, there is NO such concept as a program source line. Sure, such a concept could be defined but it's harder than it seems. Also, requiring a line structure for Extended Pascal programs would cause upward compatibility problems for programs written in Pascal. A third argument, as pointed out by other posters, was that the functionality was already present. The include file mechanism found in other languages is usually due to a lack of a strong modularity facility. Extended Pascal does a good job in this area, so this feature is not necessary. Similarly for conditional compilation. I might also point out that as languages changes, so do the paradigms change that are used to construct programs. While a tool like "make" is useful for a language like C that does not have explicit interfaces, it is a lot less efficient for languages like Extended Pascal and Ada. In any event, if you wish to use existing paradigms, you can make use of an existing preprocessor or write your own. Finally, there was a question of scope. The Pascal standard and the draft proposed Extended Pascal standard say nothing about environmental issues such as the format of a program to be processed. This is according to the program of work that JPC operated under as a standards committee. I am not saying that such issues are unimportant; in fact, a plan to address these kinds of issues and quickly issue technical reports or trial-use standards was discussed at the last meeting. Extended Pascal ain't perfect and won't replace every other programming language in existance, but it isn't supposed to. But from the comments I've seen, most people feel it is a useful language that answers many of the drawbacks of Pascal. Bob Dietrich Intel Corporation, Hillsboro, Oregon (503) 696-2092 usenet: uunet!littlei!ihf1!bobd or tektronix!tessi!agora!ihf1!bobd or tektronix!ogccse!omepd!ihf1!bobd or tektronix!psu-cs!omepd!ihf1!bobd
bobd%IHF1.UUCP%CUNYVM.CUNY.EDU@cunyvm.cuny.edu (Bob Dietrich) (12/17/88)
In article <950013@hpclscu.HP.COM> shankar@hpclscu.HP.COM (Shankar Unni) writes: >One thing that pisses me off about the Extended Pascal standard is that there >has been *NO ATTEMPT* to standardise at least a SYNTAX for pragmas within >the source. Never mind implementing a few like "include" and "if/ifdef" (can >you see my C bias showing through?) >... Sure do. >--- >Shankar (ex-Pascal hack) Unni. Sorry, but you're wrong. JPC DID try to standardize on pragmas, but could not come to a consensus position. So it was left out. Both a generalized mechanism and an include-only mechanism were considered. There were various problems that were encountered. The first is that existing practice varies so widely, someone's toes were going to get mashed. Many hours were spent arguing over what character(-sequence) should start a pragma, because no matter what you picked, one or two people would be happy and the rest would have to go home and change code. Note that standardization means coming to a consensus position, not a unanimous position, and we couldn't even achieve that. Other languages that have been primarily sponsored by a single company or agency do not have such a problem, by definition. Another problem was how to define the facility in the standard, with results similar to the first. As the existing Pascal standard is defined, there is NO such concept as a program source line. Sure, such a concept could be defined but it's harder than it seems. Also, requiring a line structure for Extended Pascal programs would cause upward compatibility problems for programs written in Pascal. A third argument, as pointed out by other posters, was that the functionality was already present. The include file mechanism found in other languages is usually due to a lack of a strong modularity facility. Extended Pascal does a good job in this area, so this feature is not necessary. Similarly for conditional compilation. I might also point out that as languages changes, so do the paradigms change that are used to construct programs. While a tool like "make" is useful for a language like C that does not have explicit interfaces, it is a lot less efficient for languages like Extended Pascal and Ada. In any event, if you wish to use existing paradigms, you can make use of an existing preprocessor or write your own. Finally, there was a question of scope. The Pascal standard and the draft proposed Extended Pascal standard say nothing about environmental issues such as the format of a program to be processed. This is according to the program of work that JPC operated under as a standards committee. I am not saying that such issues are unimportant; in fact, a plan to address these kinds of issues and quickly issue technical reports or trial-use standards was discussed at the last meeting. Extended Pascal ain't perfect and won't replace every other programming language in existance, but it isn't supposed to. But from the comments I've seen, most people feel it is a useful language that answers many of the drawbacks of Pascal. Bob Dietrich Intel Corporation, Hillsboro, Oregon (503) 696-2092 usenet: uunet!littlei!ihf1!bobd or tektronix!tessi!agora!ihf1!bobd or tektronix!ogccse!omepd!ihf1!bobd or tektronix!psu-cs!omepd!ihf1!bobd