comp.lang.ada
 help / color / mirror / Atom feed
From: porton@ex-code.com (Victor Porton)
Subject: Re: Booch: missing r/w access through iterators
Date: Fri, 08 Nov 2002 10:21:15 +0500
Date: 2002-11-08T05:27:31+00:00	[thread overview]
Message-ID: <3dcb4b43$0$307$bed64819@news.gradwell.net> (raw)
In-Reply-To: 3dc92622$0$308$bed64819@news.gradwell.net

In article <x7vn0ol148m.fsf@smaug.pushface.org>,
	Simon Wright <simon@pushface.org> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> I noticed Access_Current_Item, but with it to gain such access one
>> needs to create a new procedure! Too bad. I want direct access like:
>> 
>> function Current_Item_Access(It: Iterator'Class) return Item_Access;
> 
> I can see why you might want it, and at the moment I can't remember
> why it's not there. Perhaps something to do with the problem of
> creating the access value? (it would force the item in the Container
> to be aliased, thus constraining it .. I know this actually happens in
> the BCs but I was very unhappy with the necessary kluge).

So, if you insist on not aliased container items in general, you 
however can (and please do so):

1. Add procedure to assign a value to the current item:

procedure Assign_Current_Item (It : Iterator; Value : Item) is abstract;
-- Alternatively it can be not abstract but using Iterator_Operations
-- (see below).

2. For every iterator type add the following generic subpackage (in the
same package as the corresponding iterator type):

generic
   It: in out Iterator'Class;
package Iterator_Operations is

   Element: Item renames ...;
   -- The container element to which It refers.
   
end Iterator_Operations;

where "..." is different for each iterator type.



  parent reply	other threads:[~2002-11-08  5:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06 14:18 Booch: missing r/w access through iterators Victor Porton
2002-11-06 16:42 ` Simon Wright
2002-11-07  4:21 ` Victor Porton
2002-11-07 21:04   ` Simon Wright
2002-11-08 20:49     ` Matthew Heaney
2002-11-08 20:37   ` Matthew Heaney
2002-11-08  5:21 ` Victor Porton [this message]
2002-11-08 20:53   ` Matthew Heaney
2002-11-08 20:33 ` Matthew Heaney
replies disabled

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