Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)
From: Robert Kawulak (tigrisek_at_interia.pl)
Date: 10/11/04
- Next message: David Botton: "Re: A community Windows binding"
- Previous message: Robert Kawulak: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- In reply to: Dmitry A. Kazakov: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- Next in thread: Dmitry A. Kazakov: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- Reply: Dmitry A. Kazakov: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: David Botton: "Re: A community Windows binding"
- Previous message: Robert Kawulak: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- In reply to: Dmitry A. Kazakov: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- Next in thread: Dmitry A. Kazakov: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- Reply: Dmitry A. Kazakov: "Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|