comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 )
Subject: Re: proposal for Ada preprocessor
Date: 14 Dec 89 14:47:06 GMT	[thread overview]
Message-ID: <7423@hubcap.clemson.edu> (raw)
In-Reply-To: 3285@cbnewsl.ATT.COM

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.

  parent reply	other threads:[~1989-12-14 14:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-12-12 20:30 Dave Emery's proposal for Ada preprocessor Daniel Lee
1989-12-13 14:31 ` arny.b.engelson
1989-12-13 22:23   ` Michael Schwartz
1989-12-14 14:47   ` William Thomas Wolfe, 2847  [this message]
1989-12-14 15:11     ` Steve Tynor
1989-12-14 20:40       ` William Thomas Wolfe, 2847 
1989-12-22 23:51     ` ending a language war (was "proposal for Ada preprocessor") Dick Dunn
1989-12-23 13:04       ` Markku Sakkinen
1989-12-26 21:59       ` Preprocessors & the "spirit of Ada" William Thomas Wolfe, 2847 
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox