Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)

From: Robert Kawulak (tigrisek_at_interia.pl)
Date: 10/11/04


Date: Mon, 11 Oct 2004 00:21:06 +0200

Hi,

> In my view, array is a container and container is an abstract array.
> Iterators should be introduced as index types

    In my view it's not. Not every container has semantics of an array
(random access to every element and efficient insertions at the end of an
array), although every array may have semantics of container. I think that
for this reason containers shouldn't be all treated as abstract arrays,
because this could be misleading. After all the reason for diversity of
container types is their certain operations' efficiency difference.

> Iterators should be introduced as index types, subdivided into ordered and
> unordered ones.

    But aren't all iterators already ordered? Otherwise they couldn't
iterate...

> For ordered index types you can have ranges.

    Can't you have them with iterators?

>>> 1. (for new types) language supports multiple interface inheritance. C++
>>> does, Ada 2005 will.
>>
>> 'elements of some class -=#not#=- derived from CElement' - I meant if
>> you
>> can derive, then there's no problem.
>
> Yes, but differently to C++ in Ada that would cover almost 90% of all
> cases.

    This comparison seems to me a bit unfair. Don't you think that if C++
would use polymorphic containers, then its type system would also be
adjusted to cover 90% of all cases?

>> And you see, that's the point. I wrote: 'to make it work', and it's
>> not as easy as it seems. In order to work with container algorithms and
>> cooperate with other containers, your wrapper should also implement
>> wrappers
>> for wrapped type's iterators with wrappers for wrapped type's iterators'
>> functions... Doesn't look to me like 'a matter of one or two code lines'
>> ;-)

    Ah, sorry - I've mistaken making a wrapper for elements for making a
wrapper for containers here... Never mind ;-)

> In C++ it is checked upon inlining. In Ada it is checked upon
> instantiation. With my proposal it will be checked when you create a
> wrapper. The only difference is in the place and time.

    What do you mean by 'inlining' here? C++ templates are also
instantiated, either explicitly or implicitly (in a place you use it).

>> template <class A, class B> Foo (A & X, B & Y)
>> {
>> ...
>> Do_Something (X [I], Y [J]);
>> ...
>> }
[...]
> The contract of Foo is:
>
> 1. Foo takes two arrays as parameters.

    As long as we don't come to a common conclusion what an array is, this
is meaningless...

> 2.a Nothing is said whether indices or elements types are related.

    Isn't that true here?

With regards,
Robert Kawulak



Relevant Pages

  • Re: I want to parse @ArrayOfDays into @d1 through @d5
    ... condition on the loop indicated that the actual array length could ... -- sending the datasource, number of bins, and bin criteria as input ... My thought was to call a wrapper from the vb.net page, ... The sub-proc would parse the input array to ...
    (comp.databases.ms-sqlserver)
  • RE: Sites web service in C++
    ... I think the generated wrapper code is incorrect. ... > the first problem i run into is that wrapper class fails to compile. ... > array, because in MC++ they're always passed by reference. ... > // get the Site Templates ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Unified Ada library
    ... :> developers who think that the STL could only have been written in C++, ... Could you comment on the importance of iterators and generic ... we cannot present a standard interface to containers ...
    (comp.lang.ada)
  • Re: Calling static member function through object instance
    ... (granted - some iterators lack all the features). ... containers (an object being organized in a map and a list - list for ... fifo and map for searching). ... think it's possible to have the current interface and a lower level ...
    (comp.lang.cpp)
  • Re: Release-mode only falure when comparing STL list::iterator-s
    ... shared by iterators of all containers of this STL implementation. ... could give you real life problems only if the library should decide to ... (in the 1998 version of the standard that I ...
    (microsoft.public.vc.stl)