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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caesar.cs.montana.edu!ogicse!emory!hubcap!billwolf%hazel.cs.clemson.edu From: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 ) Newsgroups: comp.lang.ada Subject: Re: proposal for Ada preprocessor Message-ID: <7423@hubcap.clemson.edu> Date: 14 Dec 89 14:47:06 GMT References: <3285@cbnewsl.ATT.COM> Sender: news@hubcap.clemson.edu Reply-To: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu List-Id: >From arny@cbnewsl.ATT.COM (arny.b.engelson): > You can argue for or against such a thing based on philosophical reasons, > but if experienced, competent programmers are going as far as using cpp, > we really ought to create a standard Ada preprocessor. A standard preprocessor would have the advantage of being standardized, but would suffer the disadvantage that compiler optimizations are not possible where the compiler has no knowledge of high-level semantics, which is a major reason not to simply codify the preprocessing practice. One example of where this would appear inappropriate would be Classic Ada, a preprocessor used to generate Ada code which implements the object-oriented mechanisms of inheritance and dynamic binding. It would seem that substantial optimizations could be performed if the compiler had knowledge of the inheritance graph, but not if this knowledge is kept hidden from the compiler by a preprocessor. In addition, a compiler can simply have a "preprocessing" pass as its first phase if it so chooses; it would therefore seem that we would lose nothing by defining our features as part of the language rather than as part of the input to a separate preprocessor. These are of course "philosophical" arguments, but I really think the use of preprocessors should be limited to: - those who are doing programming language research - cases in which a language's revision cycle is so lengthy that important advances are not incorporated within a reasonable period of time (and this is certainly the case with the present Ada 10-year revision cycle, which I would like to see cut in half). >From emery@D74SUN.MITRE.ORG (David Emery): > Bill Wolfe sez: > > [standardization of symbols like the enumerations in SYSTEM.NAME > > should be ] > > Appropriately handled in the package which provides the binding to > > the operating system involved. OS bindings must also be standardized, > > and this is taking place; e.g., the IEEE 1003.5 Ada binding to Posix. > > First, there are often options in a program which are not bound to the > operating system. One example that I've seen used very effectively > occurs in the C source for Nethack, where features may be included or > excluded at compile time by defining or undefining certain symbols. > These features include things like different types of monsters, as > well as support for system things, such as compressing save files. I'm not familiar with Nethack (in fact, I try to stay away from anything remotely associated with hacking), but it would seem that you could do this simply by designing the software system to "with" a "Options_Desired" package specification which would be edited by the user to reflect the desired optional features; this would keep the definitions concentrated in a standard place. It seems offhand that the effect of testing whether symbols are defined or undefined can be automatically accomplished by defining an enumerated type containing all the symbol names, creating a boolean array indexed by that enumerated type, and initializing it with the appropriate values by named association. Then the user would simply edit the named associations to set desired options to True and others to False. Perhaps you had more in mind than just checking for "defined"? > Second, as Technical Editor for IEEE 1003.5 POSIX Ada Binding, I see > several instances in our binding where conditional compilation would > be very useful to an applications programmer, particularly one trying > to write portable software. This is particularly true of the > execution time symbolic constants, such as the C symbols > _POSIX_NO_TRUNC and _POSIX_VDISABLE (defined in IEEE P1003.1-1988), > and depending on the application, may also be true of the compile time > symbolic constants, such as _POSIX_JOB_CONTROL. Again, it seems to me that by a suitable definition of the binding, these things could be accomplished using an existing mechanism. Assuming that, for example, POSIX_NO_TRUNC is a boolean variable whose value changes at run-time and depends on the identity of the process requesting its value, why not simply provide a function in the binding which finds out the identity of the caller (being an operating system binding, it should be able to do this) and returns the appropriate value to the caller? (Disclaimer: not being the Technical Editor of the Posix binding, it's entirely possible that there are major flaws in my suggestion; I'm simply trying to isolate the fundamental reasons involved...) > "Ultimate standardization", even of operating system names, is a long > way away. I don't see anyone racing around trying to standardize such > things, either. Tell me about it. One particularly ludicrous example: one would think that compiler vendors would want to make it easy for you to write software which is portable across THEIR line of Ada compilers, if not anyone else's. Therefore, one would expect the compiler vendors to supply definitions of SYSTEM.NAME which enumerate all the hardware platforms for which compilers exist in the vendor's product line, so that developers could write software which targets all the platforms for which that vendor markets Ada compilers. If the vendor wanted to frustrate moving to another vendor's compiler environment, the exact names used in the enumeration could differ from those used by all other known vendors. I know of at least two major compiler vendors, with product lines spanning dozens of platforms, whose definition of SYSTEM.NAME enumerates exactly one platform: the machine on which the compiler at hand happens to run!!! > I don't believe that it's worth waiting for, > particularly since it won't solve all the problems. I'll agree that it's not worth *waiting* for... it's worth *PUSHING* for!!! Still trying to isolate why it "won't solve all the problems", though... Bill Wolfe, wtwolfe@hubcap.clemson.edu P.S. I could kick myself for not putting in a 9X suggestion that the rule about all field names being distinct be set up such that one can do variant records whereby each of the mutually exclusive variants are identically named... that rule makes us add contrived suffixes to the field names just to get them past the compiler, which would appear to be very nonproductive.