From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f89c9977a6e4ceda X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-09 12:00:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Missing in Booch: range operations Date: 09 Nov 2002 20:00:19 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <3dcb8eec$0$307$bed64819@news.gradwell.net> <3dcd4746$0$301$bed64819@news.gradwell.net> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1036872014 8339 62.49.19.209 (9 Nov 2002 20:00:14 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 9 Nov 2002 20:00:14 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:30665 Date: 2002-11-09T20:00:19+00:00 List-Id: 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. > why you don't want add my code. It would help if it compiled .. > In the first letter I've written just a rough template (for both > Booch and Charles) which is something like Booch, but not Booch. > Now the code for Booch (not checked for errors!): > > generic > For_Container: in out BC.Containers.Container'Class; > package BC.Containers.Container_Instance is > Container: BC.Containers.Container'Class renames For_Container; > type Iterator is new BC.Containers.Iterator; > function New_Iterator return Iterator'Class; > end; > > generic > For_Container: in out BC.Containers.Container'Class; > package body BC.Containers.Container_Instance is > function New_Iterator return Iterator'Class is > begin > return Iterator'Class(BC.Containers.New_Iterator(Container)); > end; > end; The first 2 lines of the package body are clearly wrong. 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 suppose it could contain a record with an actual iterator .. but then that would have to be a Containers_Base.Iterator'Class, and we know that won't work ..