Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Georg Bauhaus <bauhaus@xxxxxxxxxxxxx>
- Date: Mon, 11 Jul 2005 20:36:31 +0200
MMM wrote:
The reason is that, if one remember some mathematics, having an order is a fundamental property that distinguish vectors and lists on the one side and sets and hashes on the other.
I think it is not too helpful to consider Ada.Containers to be derived from some collection of mathematical notions and from nothing else.
First, Ada.Containers is not trying to approximate some notions
from linear algebra ("orthogonal normal basis"), metaphorically
or not. ;-) You'll have justify the implication that
we should build computer libraries around some specific
choice of notions loosly derived from mathematics. Doing this
is not a matter of course, as reactive systems are not all
about mathematics.Second, the way Ada.Containers invites you to think about the order
of elements ("containers are nothing, elements are everything").
There might be some physical/logical correspondence between the
order of elements in some container on the one hand, and their
order as implied by the user's ordering functions passed during
instantiation. Or there might not. It is more important what a
user wishes to to using the elements that happen to be elements
of some collection. I.e. while it remains advisable to choose the
proper container, Cursors are among the means to choose different
containers when the need arises, ideally without disturbing the rest of
the program.There are a number of "orders" of elements in this discussion. There are those on which you seem to build your correspondence, IIUC. Elements ordered relative to one another in the list and vector abstractions, because that is what a mathematician might assign to the notions. But some elements are ordered relative to one another in ordered sets or maps that are ordered by key. This order need not entail the use of a list, and indeed requiring List/Vector <-> order will defeat several uses of the library which is rather more flexible. If I want a set for (a) memebership test, and (b) an ordered collection, then why should I store the elements in some List oder Vector just because I want element insertion to preserve order as well? Indeed, a close correspondence of order and choice of container will defeat some generic algorithms.
I think it is of no primary concern here that some branches of mathematics can do without ordered sets, and that there is a natural ordering by position in a list. The library is for programmers, not for mathematical housekeepers. ;-) There is a treasure trove of mathematical theory of computation that starts from computation in computers, and not the other way round :-)
Another silliness is overgeneralization of the 'iterrator' concept and renaming it to 'cursor'.
Given the operations of Cursors, I can see clearly how I can use Cursor operations in iteration. OTOH, iteration means doing something again, but an STL iterator (a pointer, really, or cursor if you wish) doesn't require that I do something again...
The problem here is that this terminology doesn't reflect the fundamental differences between these types and mixes underlying mathematical conncepts in some unregular way.
If the library confuses a mathematician because he/she is used to some meanings of words, then maybe emphasising the Ada definitions, which relate to computers, will help?
-- Georg .
- Follow-Ups:
- References:
- GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitriy Anisimkov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Matthew Heaney
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitriy Anisimkov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitry A. Kazakov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Georg Bauhaus
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitry A. Kazakov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Randy Brukardt
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitry A. Kazakov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Georg Bauhaus
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitry A. Kazakov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Georg Bauhaus
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitry A. Kazakov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Matthew Heaney
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Dmitry A. Kazakov
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: Matthew Heaney
- Re: GCC 4.0 Ada.Containers Cursor danger.
- From: MMM
- GCC 4.0 Ada.Containers Cursor danger.
- Prev by Date: Re: Unchecked_Conversion and task pointer.
- Next by Date: Re: GCC 4.0 Ada.Containers Cursor danger.
- Previous by thread: Re: GCC 4.0 Ada.Containers Cursor danger.
- Next by thread: Re: GCC 4.0 Ada.Containers Cursor danger.
- Index(es):
Relevant Pages
|