Re: ADA Popularity Discussion Request

From: Georg Bauhaus (sb463ba_at_l1-hrz.uni-duisburg.de)
Date: 09/14/04

  • Next message: Luca Stasio: "Re: Ada Singleton Pattern"
    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


  • Next message: Luca Stasio: "Re: Ada Singleton Pattern"

    Relevant Pages

    • Re: trouble creating array of objects
      ... > about dynamically multidimensinoal arrays is described. ... it's an excellent learning excercise. ... This is called the C++ standard template library and it is an addition to ... >> Another reason might be the overheads incurred. ...
      (alt.comp.lang.learn.c-cpp)
    • Re: Help needed for a sorting code in the literature
      ... It doesn't need to deal with checking memory. ... >>template version where the type being sorted is a template parameter. ... >>I have tested the speed of the heapsort code above on arrays of up to ...
      (sci.crypt)
    • Help: How many explicit specializations required?
      ... I need to have a template for T ... Passing arrays of T will be resolved into case 2. ... void func ... int main ...
      (comp.lang.cpp)
    • Re: Code pages
      ... > used GetEncoderto write the byte arrays to the file. ... > But I also have to write to a sequential file. ... > I ended up first encoding the strings to byte arrays, writing them to ...
      (microsoft.public.dotnet.languages.vb)
    • Re: IO with Java Objects: slow!
      ... > Writing it out to the disk in an ObjectOutputStream as a single Object ... you'll definitely find a tradeoff between Arrays (which are Objects ... and the Collections classes. ...
      (comp.lang.java.programmer)