comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Run-time accessibility checks
Date: Tue, 16 Dec 2008 16:21:00 -0600
Date: 2008-12-16T16:21:00-06:00	[thread overview]
Message-ID: <gi99lq$moq$1@munin.nbi.dk> (raw)
In-Reply-To: k2ftogbqmojg.yrjw3ldbi604.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:k2ftogbqmojg.yrjw3ldbi604.dlg@40tude.net...
...
>> Moreover, elements of many forms of
>> container don't have any order, so you can't do anything useful with the
>> index by itself -- but operations like iteration are still meaningful.
>
> No, if index is unordered and not dense, then iteration is meaningless. It
> is a broken abstraction then. If you want to iterate a container you have
> to order its elements. That is equivalent to existence some ordered dense
> index of.

Not at all. You are saying that "forall" (that is, do something to all 
elements of a container) is not a useful iteration if the elements don't 
have an order. That's pretty hard to believe; indeed, the value of an 
iterator is is specifically because the order of the elements is not 
specified; without that, there is no way to get all of the elements via 
their cursors (or indexes, if you prefer).

> The index can be of the type System.Address, that is no matter.
> But to be able to iterate is a contract on the container. It is IMO a very
> bad idea to assume all containers to fulfill this contract.

I would never want to say *never* (there is always a counter-example), but 
surely all of the classic containers (including a "bag") need iteration. 
It's true that the implementation of a "bag" will necessarily impose an 
order on the elements, but that order is not interesting and shouldn't be 
considered part of the abstraction. But the ability to get all elements of a 
bag for processing is a fundamental operation of the container.

                              Randy.





  reply	other threads:[~2008-12-16 22:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-06 10:15 Run-time accessibility checks (was: Construction initialization problem) Dmitry A. Kazakov
2008-12-06 17:10 ` Ludovic Brenta
2008-12-07  8:44   ` Run-time accessibility checks Dmitry A. Kazakov
2008-12-07 14:56     ` Ludovic Brenta
2008-12-07 19:22       ` Dmitry A. Kazakov
2008-12-11  1:03     ` Randy Brukardt
2008-12-11  9:08       ` Dmitry A. Kazakov
2008-12-11  0:55 ` Run-time accessibility checks (was: Construction initialization problem) Randy Brukardt
2008-12-11  9:48   ` Run-time accessibility checks Dmitry A. Kazakov
2008-12-11 11:21     ` Georg Bauhaus
2008-12-11 11:40       ` Dmitry A. Kazakov
2008-12-11 22:15   ` Run-time accessibility checks (was: Construction initialization problem) Randy Brukardt
2008-12-11 22:31     ` Randy Brukardt
2008-12-13  0:49       ` Randy Brukardt
2008-12-13  9:06         ` Run-time accessibility checks Dmitry A. Kazakov
2008-12-16  1:53           ` Randy Brukardt
2008-12-16  9:28             ` Dmitry A. Kazakov
2008-12-16 22:21               ` Randy Brukardt [this message]
2008-12-17  8:54                 ` Dmitry A. Kazakov
2008-12-12  9:21     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox