comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shellx.best.com>
Subject: Re: Ada vs C++ (Ada 0X)
Date: 1997/09/09
Date: 1997-09-09T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SGI.3.95.970909223117.21914B-100000@shellx.best.com> (raw)
In-Reply-To: 34155698.4AE9@osc.edu


On Tue, 9 Sep 1997, James B. White, III (Trey) wrote:
> Brian Rogoff wrote:
> 
> > My question is whether it is necessary for your purposes to have this
> > capability directly supported in the language, or if some source to source
> > transformation tool would suffice; i.e., an Ada aware macro system or some
> > other such tool. I recall reading about such a macro system (M5?) but I
> > forget where...
> 
> If it's supported in the language, it is portable. Before anyone starts
> slamming the portability of C++ and templates, realize the situation has
> changed dramatically over the last few months.

Well, "portable", like "simple", is overloaded. If you had (for example) an 
Ada aware macro processor written in Ada 95 (so it can be ported), why is 
that not portable? Bob Duff comments that it would interfere with other 
tools, which is true, but I guess I was thinking of ways to solve your 
problem before "0X". 

> I guess my real point is the following. Expression templates in C++
> demonstrate a level of functionality absent from Ada. 

I think this level of functionality was deliberately omitted from Ada. 
Perhaps the ban on "macro" like features should be re-examined.

> I certainly don't advocate  supporting C++-style templates. 

Whoa, C++ style templates have lots of things in common with Ada generics, 
and some other things in common with macros. Whether this is unification or
confusion I don't know. Some of the aspects of C++ templates which are for 
parametric polymorphism, say especially automatic instantiation of generic
subprograms :-), seem like they make sense in an Ada context. Consider the
following relaxations of Ada rules (which have *nothing* to do with the
macro stuff)

(1) The name of a generic subprogram is allowed to appear anywhere that a
    non-generic subprogram name is allowed.

(2) Non-generic subprograms may overload generic ones.

(3) A subprogram component of a generic package may appear anywhere that
    a non-generic subprogram name is allowed.

(4) A generic package name may be specified in a "use" clause, allowing
    subprogram components to be specified without qualification according
    to (3).

(5) Some or all real parameters may be omitted in an explicit instantiation.
                                                                                
These relaxations of restrictions would be in the spirit of the C++
template mechanism, yet they wouldn't allow the kind of macro-like
computing you are discussing. Ada generics strike me as being a mechanism
for parametric polymorphism, not macro instantiation, so I would hope any 
Ada 0X proposal you want to try out on the net would not try to stuff 
all sorts of compile time computation onto generics. OTOH, I see no problem 
with changes to allow automatic instantiation, at least not in the sense of 
doing violence to Ada generics.

-- Brian






  reply	other threads:[~1997-09-09  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <md5:DB04B9CCA20E8EB6142C50D2DE055239>
     [not found] ` <34090462.4652@easystreet.com>
     [not found]   ` <Pine.SGI.3.95.970831115842.17664A-100000@shellx.best.com>
1997-09-02  0:00     ` Ada vs C++ James B. White, III (Trey)
     [not found]       ` <Pine.SGI.3.95.970904201703.13590A-100000@shellx.best.com>
1997-09-05  0:00         ` Jon S Anthony
1997-09-05  0:00       ` Robert Dewar
1997-09-05  0:00         ` Larry Kilgallen
1997-09-05  0:00         ` Brian Rogoff
1997-09-08  0:00         ` Ada vs C++ (Expression Templates) James B. White, III (Trey)
1997-09-08  0:00           ` Matthew Heaney
1997-09-08  0:00       ` Ada vs C++ Richard A. O'Keefe
1997-09-08  0:00         ` Ada vs C++ (vs Lisp) James B. White, III (Trey)
1997-09-08  0:00           ` Brian Rogoff
1997-09-09  0:00             ` Ada vs C++ (Ada 0X) James B. White, III (Trey)
1997-09-09  0:00               ` Brian Rogoff [this message]
1997-09-10  0:00               ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1997-09-11  0:00                 ` Anonymous
1997-09-11  0:00                   ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1997-09-09  0:00             ` Ada vs C++ (vs Lisp) Robert A Duff
1997-09-09  0:00       ` Ada vs C++ Joerg Rodemann
1997-09-09  0:00         ` Ada vs C++ (high-performance libraries) James B. White, III (Trey)
replies disabled

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