Re: GCC 4.0 Ada.Containers Cursor danger.



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 .




Relevant Pages

  • Ten all-time most influential math books
    ... books in the world", American Mathematical Monthly ... of Mathematics last term, with rather interesting results. ... To be sure, no two lists will ... influence on the teaching and knowledge of geometry ...
    (sci.math)
  • Re: Ten all-time most influential math books
    ... books in the world", American Mathematical Monthly ... of Mathematics last term, with rather interesting results. ... To be sure, no two lists will ... influence on the teaching and knowledge of geometry ...
    (sci.math)
  • Re: Specifying Sets
    ... common practice in science and mathematics to co-opt terms from ordinary ... sets "lists" and vice versa and it wouldn't affect the mathematics one ... If 'all' blondes picks out all blondes, what does the 'set' of all ... The term list used in the quote is different from the list you claim is used by mathematics. ...
    (sci.logic)
  • Re: Resiliency To New Data Requirements
    ... But if the mathematicians tell me the mathematics was not ... mistake was requiring software development teams to model data in what ... Are these consistency rules only related to relationships between ... it disallows lists as attribute values, ...
    (comp.databases.theory)
  • Re: Specifying Sets
    ... common practice in science and mathematics to co-opt terms from ordinary ... 'members' then "The set of all solar planets has nine members" reduces ... If 'all' blondes picks out all blondes, what does the 'set' of all ... "1) The method of enumeration lists the contents or objects of the set ...
    (sci.logic)