From: Anh Vo <anhvofrcaus@gmail.com>
Subject: Re: Rational for not making cursor tagged in Containers
Date: 20 Apr 2007 09:08:37 -0700
Date: 2007-04-20T09:08:37-07:00 [thread overview]
Message-ID: <1177085317.148207.98340@o5g2000hsb.googlegroups.com> (raw)
In-Reply-To: <f099s8$k47$1@jacob-sparre.dk>
On Apr 19, 7:53 pm, "Randy Brukardt" <r...@rrsoftware.com> wrote:
> "Anh Vo" <anhvofrc...@gmail.com> wrote in message
>
> > It seems that it is not balanced between Container types and its
> > cursors. I just want to know what rationale behind it for not making
> > cursor a tagged type.
>
> I think there are two reasons:
>
> (1) The original designer of the containers library intended for cursors to
> be implemented as a bare access value; adding a tag makes that messier and
> doubles the size of the cursors. I personally don't find this too important.
>
> (2) Ada does not allow an operation to be primitive for two tagged types.
> (I'm sure we'll hear at length from Dmitry on this. ;-) That would mean that
> operations like:
> procedure Delete (Container : in out Vector; Index : in Cursor);
> would be illegal. That could be worked around by making the cursor
> classwide:
Thanks for your explanation. Reason in (2) is more legitimate.
> procedure Delete (Container : in out Vector; Index : in Cursor'Class);
> but now you don't have much taggedness left. On most operations, you're not
> even losing prefix notation (as the cursor is the second parameter).
agreed.
> Indeed, the real reason for your problem is that container is implicit in
> Cursor operations that read from the container:
> function Element (Position : Cursor) return Element_Type;
>
> A prefix call like
> My_Cursor.Element
> doesn't make much sense, because a cursor is just an accessor, you're not
> extracting the element from it! You really ought to be able to say:
> My_Container.Element (Position => My_Cursor)
> which makes it clear where the element is coming from.
The latter is already given. I am not quite agreed with the former
because I do not see any thing wrong to extract an element pointed by
an accessor if and only if Cursor is tagged.
> I admit we didn't think much about these issues. When it was suggested that
> perhaps the container type should be visibly tagged, I recall someone noted
> that would allow the prefix notation. And that seemed good; but I don't
> think anyone noted that it doesn't work sometimes.
It is a good lesson learned.
AV
prev parent reply other threads:[~2007-04-20 16:08 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-19 16:05 Rational for not making cursor tagged in Containers Anh Vo
2007-04-19 18:25 ` Robert A Duff
2007-04-19 19:28 ` Anh Vo
2007-04-19 20:45 ` Robert A Duff
2007-04-19 21:43 ` Dmitry A. Kazakov
2007-04-19 23:59 ` Ray Blaak
2007-04-20 7:54 ` Dmitry A. Kazakov
2007-04-20 10:56 ` Georg Bauhaus
2007-04-20 10:39 ` Dmitry A. Kazakov
2007-04-20 14:42 ` Georg Bauhaus
2007-04-20 14:45 ` Georg Bauhaus
2007-04-20 15:13 ` Dmitry A. Kazakov
2007-04-20 19:37 ` Georg Bauhaus
2007-04-20 19:32 ` Dmitry A. Kazakov
2007-04-20 20:59 ` Robert A Duff
2007-04-20 22:14 ` Dmitry A. Kazakov
2007-04-23 17:38 ` Adam Beneschan
2007-04-23 19:18 ` Dmitry A. Kazakov
2007-04-24 0:15 ` Adam Beneschan
2007-04-24 10:43 ` Dmitry A. Kazakov
2007-04-24 16:27 ` Adam Beneschan
2007-04-24 20:19 ` Dmitry A. Kazakov
2007-04-26 0:58 ` Adam Beneschan
2007-04-26 7:50 ` Dmitry A. Kazakov
2007-04-26 8:09 ` Markus E Leypold
2007-04-27 8:46 ` Dmitry A. Kazakov
2007-04-27 11:37 ` Markus E Leypold
2007-04-28 17:35 ` Dmitry A. Kazakov
2007-04-29 2:31 ` Randy Brukardt
2007-04-29 8:45 ` Dmitry A. Kazakov
2007-04-27 20:44 ` Robert A Duff
2007-04-26 8:33 ` Markus E Leypold
2007-04-26 11:09 ` Markus E Leypold
2007-04-20 19:55 ` Randy Brukardt
2007-04-22 9:54 ` Georg Bauhaus
2007-04-22 11:19 ` Dmitry A. Kazakov
2007-04-20 20:44 ` Robert A Duff
2007-04-21 5:38 ` Randy Brukardt
2007-04-22 1:14 ` Robert A Duff
2007-04-22 4:08 ` Randy Brukardt
2007-04-20 20:11 ` Randy Brukardt
2007-04-20 21:28 ` Dmitry A. Kazakov
2007-04-21 5:33 ` Randy Brukardt
2007-04-21 9:39 ` Dmitry A. Kazakov
2007-04-22 4:28 ` Randy Brukardt
2007-04-22 8:38 ` Dmitry A. Kazakov
2007-04-23 23:26 ` Randy Brukardt
2007-04-24 10:43 ` Dmitry A. Kazakov
2007-04-24 8:58 ` Georg Bauhaus
2007-04-24 12:21 ` Dmitry A. Kazakov
2007-04-21 4:48 ` unifying arrays and records (was Re: Rational for not making cursor tagged in Containers) Ray Blaak
2007-04-20 17:05 ` Rational for not making cursor tagged in Containers Ray Blaak
2007-04-20 18:46 ` Dmitry A. Kazakov
2007-04-20 18:52 ` Ray Blaak
2007-04-20 19:54 ` Robert A Duff
2007-04-20 1:18 ` Anh Vo
2007-04-20 7:53 ` Dmitry A. Kazakov
2007-04-20 9:26 ` Maciej Sobczak
2007-04-20 10:15 ` Dmitry A. Kazakov
2007-04-20 11:59 ` Jean-Pierre Rosen
2007-04-20 13:23 ` Anh Vo
2007-04-20 16:02 ` Jean-Pierre Rosen
2007-04-21 2:53 ` Anh Vo
2007-04-20 3:03 ` Randy Brukardt
2007-04-20 2:53 ` Randy Brukardt
2007-04-20 16:08 ` Anh Vo [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox