comp.lang.ada
 help / color / mirror / Atom feed
From: porton@ex-code.com (Victor Porton)
Subject: Re: Missing in Booch: range operations
Date: Mon, 11 Nov 2002 10:41:22 +0500
Date: 2002-11-11T05:48:42+00:00	[thread overview]
Message-ID: <3dcf44ba$0$300$bed64819@news.gradwell.net> (raw)
In-Reply-To: 3dcb8eec$0$307$bed64819@news.gradwell.net

In article <x7vd6pe344s.fsf@smaug.pushface.org>,
	Simon Wright <simon@pushface.org> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> I don't understand what is "the STL/Charles view of iteration" and
> 
> I meant, the idea that two iterators designate a range within a
> container over which some algorithm is to be applied.

You cause me to wonder that you don't want accept this!

Programmers often need to deal with a range of elements of
a container. I now deal with exactly this (modifying a
HTML stream I consider parts of a HTML element as ranges in
the buffer to which I read from a file).

In any case I use this range, but now I just designate it by
natural numbers instead of iterators.

Well, e.g. many sorting algorithms deal with ranges.

Why?!!

> This modified code nearly compiles:
> 
>    with BC.Containers;
>    generic
>       with package Containers_Base is new BC.Containers (<>);
>       For_Container : in out Containers_Base.Container'Class;
>    package BC.Containers.Container_Instance is
>       Container : Containers_Base.Container'Class renames For_Container;
>       type Iterator is new Containers_Base.Iterator with private;
>       function New_Iterator return Iterator'Class;
>    private
>       type Iterator is new Containers_Base.Iterator with null record;
>    end BC.Containers.Container_Instance;
> 
>    package body BC.Containers.Container_Instance is
>       function New_Iterator return Iterator'Class is
>       begin
>          return Iterator'Class (Containers_Base.New_Iterator (Container));
>       end;
>    end BC.Containers.Container_Instance;
> 
> but fails with
> 
>    bc-containers-container_instance.ads:10:09: type must be declared
>    abstract or "RESET" overridden
> 
> and when you think about it it's hard to see how this type Iterator
> could be of any use (the concrete iterators in BCs are derived from
> BC.Containers.Iterator, not from this new one).

I don't see your point about how this scheme of derivation would 
disturb its use.

P.S. I want iterator ranges. May be I will even create modified
version of Booch at SourceForge. I think this split would not
cause any harm to the community as in any case we now only in the
process of standartization of Ada Standard Containers.



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

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-08 10:09 Missing in Booch: range operations Victor Porton
2002-11-08 15:01 ` Stephen Leake
2002-11-08 21:07 ` Matthew Heaney
2002-11-09 13:56   ` Simon Wright
2002-11-13 20:17     ` Matthew Heaney
2002-11-08 21:35 ` Matthew Heaney
2002-11-09  8:24 ` Victor Porton
2002-11-13 20:22   ` Matthew Heaney
2002-11-13 22:28     ` Stephen Leake
2002-11-09  8:46 ` Victor Porton
2002-11-09 14:12   ` Simon Wright
2002-11-09 14:04 ` Simon Wright
2002-11-09 16:12 ` Victor Porton
2002-11-09 20:00   ` Simon Wright
2002-11-11  5:41 ` Victor Porton [this message]
2002-11-11  6:39   ` Simon Wright
2002-11-11  7:50 ` Victor Porton
2002-11-13 20:26   ` Matthew Heaney
2002-11-13 22:28     ` Stephen Leake
replies disabled

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