Re: ADA Popularity Discussion Request
From: Georg Bauhaus (sb463ba_at_l1-hrz.uni-duisburg.de)
Date: 09/14/04
- Previous message: Kevin Cline: "Re: ADA Popularity Discussion Request"
- In reply to: Kevin Cline: "Re: ADA Popularity Discussion Request"
- Next in thread: Martin Krischik: "Re: ADA Popularity Discussion Request"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 14 Sep 2004 17:32:26 +0000 (UTC)
Kevin Cline <kevin.cline@gmail.com> wrote:
: C++
: is an excellent language for writing such a library,
No doubt.
: because template
: functions can instantiate new types automatically, e.g.
But that is not the only reason that C++ is an excellent language
for writing such a library?
: template <int M, N, P>
: matrix<M,P> operator*(const matrix<M,N>& lhs, conat matrix<N,P>&
: rhs) {...}
Note that all the instantiations appear to be there in order to have
bounded arrays. I think. It might be an advantage that the ranges
are known to match; I guess this is different from what Ada's gives
you when the compiler cannot find out at compile time:
"Note that errors such as when bounds of arrays do not match raise
Constraint_Error by analogy with built-in array operations."
(from the AI mentioned below.)
: You could do the same in Ada, but first you would have to explicitly
: instantiate the five functions. That gets old really fast.
I might not have to do the same thing, because Ada arrays and
matrices tend to come with their bounds determined when a matrix
object is declared and assigned. :-) The latest on Vector and Matrix ops
for Ada 200Y is available in
http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00296.TXT?rev=1.17
: This ground is covered extensively in Scientific and Engineering C++ :
: An Introduction with Advanced Techniques and Examples by John J.
: Barton, Lee R. Nackman.
Thanks for the pointer.
:> : I very rarely have any need or use
:> : for a statically sized array.
:> x: Vec := make(5);
:
: But even though X has a run-time determined size, its size is now
: fixed. I can neither add or remove elements without creating an
: entirely new vector.
Sure. That's a property of the built in arrays. They are not
flex arrays. Would you want to change the size of a matrix, too?
-- Georg
- Previous message: Kevin Cline: "Re: ADA Popularity Discussion Request"
- In reply to: Kevin Cline: "Re: ADA Popularity Discussion Request"
- Next in thread: Martin Krischik: "Re: ADA Popularity Discussion Request"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|