Re: GCC 4.0 Ada.Containers Cursor danger.



On Thu, 07 Jul 2005 12:38:57 +0200, Georg Bauhaus wrote:

> Dmitry A. Kazakov wrote:
>> On Wed, 6 Jul 2005 18:07:38 -0500, Randy Brukardt wrote:
>
>>>>It is not clear to me what the semantics a cursor has. Is it a location in the container?
>
>>>It's not a location, and it wouldn't make sense for it to be one (other than
>>>for a Vector).
>
>> But it definitely refers to a location. Otherwise iteration using cursor
>> would be impossible.
>
> Why? A cursor designates an element. There are operations
> on cursors, some of them let us move a cursor from one
> element to another. Then the cursor designates another element.

Rather it does some element at another location. The element is of little
matter here (for this concrete case, note.) Otherwise "Replace" would have
no sense. BTW the parameters of the type Cursor are routinely named
"Position"!

> I don't think there an implied requirement to think of locations.

Then you have to throw out "Next", "First" etc.

It is the location that tells you what's next. You could make elements
carrying the location with, like by deriving them from an abstract list
element. But that is not the design of the containers. Neither you will
need any cursors then, though a lot of other problems instead... (:-))

As I said before, it is difficult if possible to assign any definite
semantics to cursors, such that would be consistent across all operations
on them.

-------------
It is really time to think about downward closures (subroutine types),
ranges as ADTs (user-defined index types) etc.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Decouple SQL queries from class in OOP design
    ... > Dmitry A. Kazakov wrote: ... >> Not only the cursor but DB as a whole is a subject of abstraction. ... > as Prolog, and much more sucessful than Prolog. ...
    (comp.object)
  • Re: GCC 4.0 Ada.Containers Cursor danger.
    ... > Dmitry A. Kazakov wrote: ... >> It is not clear to me what the semantics a cursor has. ... "Each container includes a cursor, which is a reference to an element ...
    (comp.lang.ada)
  • Re: GCC 4.0 Ada.Containers Cursor danger.
    ... Dmitry A. Kazakov wrote: ... Then the cursor designates another element. ...
    (comp.lang.ada)
  • Re: GCC 4.0 Ada.Containers Cursor danger.
    ... > Dmitry A. Kazakov wrote: ... A cursor designates an element. ... Enumerate all elements in the container [i.e. define an order ... There are locations implied by sorting order. ...
    (comp.lang.ada)
  • Re: Youve seen sardines...
    ... cursor is in the origional pic, it will enlarge to that area. ... BTW, I thought the corect phrasing was "Whoopass" ...
    (rec.boats)