comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: STL, Ada, C++ (Was Re: The Next Microsoft?)
Date: 2000/05/10
Date: 2000-05-10T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.4.21.0005102153451.11490-100000@shell5.ba.best.com> (raw)
In-Reply-To: 8fab3r$642$1@slb6.atl.mindspring.net

On Wed, 10 May 2000, Richard D Riehle wrote:
> In article <Pine.BSF.4.21.0005090756520.24683-100000@shell5.ba.best.com>,
> 	Brian Rogoff <bpr@shell5.ba.best.com> wrote:
> 
> >On Tue, 9 May 2000, Richard D Riehle wrote:
> 
> >> I wonder if there is a trade-off here between convenience and type
> >> safety.  Ada tends to lean heavily in the direction of safety,
> >> and automatic instantiation seems not quite as focused on that issue.
> >
> >Overloading, runtime dispatching, and "use clauses" don't seem quite
> >as focused on safety either. The only way that automatic instantiation 
> >is troubling is that in the case of a language like C++ it is undecidable, 
> >I think in standard C++ they limit the depth of template expansion
> >(Hyman?) and I imagine a similar solution would be needed for Ada.  
> 
> Overloading is resolved at compile time.  

Automatic instantiation is still a "compile time" notion. It isn't the
same as a runtime method select, so it is even safer than OO style 
programming with tagged types. 

Programmers used to languages like ML, Haskell, and Clean use "automatic 
instantiation" all of the time, they just don't call it that. I find that 
it works OK from the point of view of safety and lack of run time errors, 
but that the error messages in OCaml are not as good as in GNAT and even 
worse in some other FPs. This is getting better though, and doesn't look 
like a fundamental problem.

I haven't seriously used C++ for a few years now, so it wouldn't be fair 
for me to comment on the error messages from heavy template programming.
Once again though, this is all having to do with "ease of writing",
duration of compilation, etc. 

> It is a little safer than run-time
> dispatching, according to some practitioners.  Use clauses certainly can
> be problematic with regard to visibility, but they generally do not obviate 
> type safety.  Of course, Geoff Mendal's paper on this subject illustrates 
> some of the concerns for use clauses with predefined types.  The question
> I was raising was whether we would expect the same level of confidence 
> from automatic instantiation we already expect from Ada's model of generic
> instantiation.  

How do you measure level of confidence? If you mean, do I trust that type 
checkers for languages with parametric polymorphism can be made to work, 
I do. I use a language with parametric polymorphism, and it works for the 
scale of project I use it in. It's hard to look at any feature
independently, but this one compresses code by eliminating cascading
instantiations. It allows higher level programming without requiring 
runtime overhead, at least in C++.

> >> For example, the model for generic formal package parameters in Ada
> >> forces the designer to create a generic signature package corresponding to
> >> the parameter.  This makes automatic instantiation quite difficult to
> >> achieve, but has the benefit of pretty thorough compile-time evaluation
> >> of all the elements of the signature.  
> >
> >> The goals of C++ are different from those of Ada.    
> >
> >Programming languages don't have goals, people do. Languages are artifacts 
> >that can and should be discussed dispassionately. 
> 
> Please excuse my inadvertant anthropomorphism of the languages.  Perhaps I 
> should have said, "The goals of the C++ designers were different from those
> of the Ada designers."  With that clarification, I doubt you would disagree
> that there were some goals, at very minimum, a loose rationale, for the 
> design of both languages under discussion.

Sure, I shouldn't be nitpicky, but C++ and Ada are both intended to be
capable of doing systems programming. Ada isn't purely about safety, and 
as you well know has many unsafe features. And new ones were added which
are also verboten in SPARK: tagged types, aliased/access all, etc. 

-- Brian






  reply	other threads:[~2000-05-10  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8eg37k$15n$1@nnrp1.deja.com>
     [not found] ` <8epkoa$b8b$1@nnrp1.deja.com>
     [not found]   ` <E$OcUgAHHIE5Ewfl@quik.freeuk.net>
     [not found]     ` <8eu0ob$7qv$1@nnrp1.deja.com>
2000-05-05  0:00       ` The Next Microsoft? Ray Blaak
2000-05-05  0:00         ` Bobby D. Bryant
2000-05-05  0:00         ` Mark Atwood
2000-05-05  0:00           ` Ayende Rahien
2000-05-05  0:00           ` Hyman Rosen
2000-05-05  0:00             ` Mark Atwood
2000-05-05  0:00               ` Hyman Rosen
2000-05-05  0:00                 ` Jon S Anthony
2000-05-05  0:00                   ` Hyman Rosen
2000-05-05  0:00                     ` Bill Greene
2000-05-06  0:00                       ` Ehud Lamm
2000-05-07  0:00                       ` STL, Ada, C++ (Was Re: The Next Microsoft?) Brian Rogoff
2000-05-08  0:00                         ` Robert Dewar
2000-05-07  0:00                           ` Brian Rogoff
2000-05-08  0:00                           ` Pascal Obry
2000-05-08  0:00                             ` Brian Rogoff
2000-05-08  0:00                               ` Robert Dewar
2000-05-08  0:00                                 ` Pascal Obry
2000-05-09  0:00                                 ` STL, Ada, C++ Harry Erwin
2000-05-09  0:00                                   ` Robert A Duff
2000-05-09  0:00                               ` STL, Ada, C++ (Was Re: The Next Microsoft?) Marin D. Condic
2000-05-09  0:00                                 ` Robert Dewar
2000-05-09  0:00                                   ` Marin D. Condic
2000-05-08  0:00                           ` Hyman Rosen
2000-05-08  0:00                             ` Brian Rogoff
2000-05-09  0:00                             ` Richard D Riehle
2000-05-09  0:00                               ` Brian Rogoff
2000-05-09  0:00                                 ` Hyman Rosen
2000-05-09  0:00                                   ` Robert A Duff
2000-05-09  0:00                                     ` Hyman Rosen
2000-05-09  0:00                                 ` Brian Rogoff
2000-05-10  0:00                                 ` Richard D Riehle
2000-05-10  0:00                                   ` Brian Rogoff [this message]
2000-05-08  0:00                         ` Florian Weimer
2000-05-05  0:00                     ` The Next Microsoft? Jon S Anthony
replies disabled

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