comp.lang.ada
 help / color / mirror / Atom feed
From: hymie@panix.com (Hyman Rosen)
Subject: Re: Ada vs. C++ (Readability)
Date: 1997/09/11
Date: 1997-09-11T00:00:00+00:00	[thread overview]
Message-ID: <5v9n4o$6k6@panix.com> (raw)
In-Reply-To: 3416458e.0@news.uni-ulm.de



In article <3416458e.0@news.uni-ulm.de>,
Joerg Rodemann <rodemann@mathematik.uni-ulm.de> wrote:
>Nevertheless, I can't help to think overloading here is not a good idea if
>you want someone else to read this. The only hint that the first two 
>numbers are not omitted is that x is of type ray.

I would expect that anyone maintaining this code is going to first acquire
some knowledge of the libraries involved, or else they are not going to
succeed very well. The documentation for Blitz++ and the exmaples provided
describe and explain this usage for creating Arrays.

>Another comment, or question, about the expression templates: what about
>type safety? I understand that C++ templates are not in any way type safe
>wrt the instantion parameters.

Expression templates are completely typesafe, as are C++ templates in
general. It's easiest if you think of templates as a fancy macro facility.
The code which results from instantiating a template with specific types
and values is typesafe in the same way that writing the equivalent code
by hand would be.

It's true that C++ templates give you no way of formally stating the
operations that the generic parameters must support. Instead, C++ relies
on "legality by usage". If the result of an instantiation is legal code
given the specific types, then everything is fine. If the type does not
support some operation that the template requires, and that part of the
template is actually used, then the compiler will give you an appropriate
error message.




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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  0:00 Ada vs. C++ (Readability) Joerg Rodemann
1997-09-09  0:00 ` Hyman Rosen
1997-09-10  0:00   ` Joerg Rodemann
1997-09-11  0:00     ` Hyman Rosen [this message]
1997-09-10  0:00   ` Simon Wright
1997-09-11  0:00     ` Robert Dewar
1997-09-11  0:00       ` Hyman Rosen
1997-09-12  0:00         ` Joerg Rodemann
1997-09-15  0:00         ` Richard A. O'Keefe
replies disabled

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