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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e28ffe0eaf31d1b6 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Ada vs C++ (Ada 0X) Date: 1997/09/09 Message-ID: #1/1 X-Deja-AN: 271207302 References: <34090462.4652@easystreet.com> <340C47F8.670B@osc.edu> <5v0lba$jnv$1@goanna.cs.rmit.edu.au> <341404B4.13CB@osc.edu> <34155698.4AE9@osc.edu> Newsgroups: comp.lang.ada Date: 1997-09-09T00:00:00+00:00 List-Id: 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