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,f039470e8f537101 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-30 06:16:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!info1.fnal.gov!nntp.upenn.edu!canoe.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada References: <1058968422.225561@master.nyc.kbcfp.com> <3F200AD0.94F79098@adaworks.com> <7u9Ua.13412$634.10307@nwrdny03.gnilink.net> <3F215120.1040706@attbi.com> <1059151910.357790@master.nyc.kbcfp.com> <1059416297.548253@master.nyc.kbcfp.com> <1059510832.459614@master.nyc.kbcfp.com> Subject: Re: Non-philosophical definition of Eiffel? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Wed, 30 Jul 2003 13:16:31 GMT NNTP-Posting-Host: 65.110.133.134 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1059570991 65.110.133.134 (Wed, 30 Jul 2003 06:16:31 PDT) NNTP-Posting-Date: Wed, 30 Jul 2003 06:16:31 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:41007 Date: 2003-07-30T13:16:31+00:00 List-Id: "Berend de Boer" wrote in message news:un0ewiv53.fsf@xsol.com... > >>>>> "Hyman" == Hyman Rosen writes: > > What about this statement: > > "In general, in the design of Charles I have been willing to trade > type-safety for flexibility and efficiency." > > Telling, isn't it? What that refers to specifically is the case of "dangling iterators." If I do this: procedure Op (C : in out Container_Type; E : in out Element_Type) is I : Iterator_Type; begin Insert (C, E, I); Delete (C, I); E := Element (I); -- dangling reference end; The model in Charles is that an iterator is implemented as a pointer to an internal node of storage, and it therefore confers no safety benefits beyond what a plain access type gives you. To get a completely safe iterator -- one that prevents a dangling reference from ever occurring-- it is necessary to either reduce flexibility or reduce efficiency. But as a library designer, I am an no position to decide how best to make that trade-off -- only the application developer can know that. Therefore, my philosophy has been to provide the most flexible and efficient primitives possible, which can then be combined as desired by the library user. We are in agreement that all this business in Java where you have to perform a downcast when you extract an element is not type safe. But this is hardly the case in the STL and in Charles, which provide containers that really are type safe, unlike Java. As for a container-of-D being a subclass of container-of-B, this model doesn't apply to STL or Charles, because those libraries eschew inheritance in favor of alternate (and simpler) mechanisms. By using an iterator and a generic algorithm, the container itself disappears. So instead of a container-of-D, you have a sequence-of-D, which is a sequence-of-B, which is the equivalent of a container-of-B. No inheritance is necessary, thank you very much. I'll have another release of Charles ready in the next few days. http://home.earthlink.net/~matthewjheaney/charles/