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-Thread: 103376,7d83a6223f4f2443 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Run-time accessibility checks Date: Tue, 16 Dec 2008 16:21:00 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <1xgim3qybjw07$.16nw9986hywhh.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1229466106 23322 69.95.181.76 (16 Dec 2008 22:21:46 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 16 Dec 2008 22:21:46 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:3010 Date: 2008-12-16T16:21:00-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:k2ftogbqmojg.yrjw3ldbi604.dlg@40tude.net... ... >> Moreover, elements of many forms of >> container don't have any order, so you can't do anything useful with the >> index by itself -- but operations like iteration are still meaningful. > > No, if index is unordered and not dense, then iteration is meaningless. It > is a broken abstraction then. If you want to iterate a container you have > to order its elements. That is equivalent to existence some ordered dense > index of. Not at all. You are saying that "forall" (that is, do something to all elements of a container) is not a useful iteration if the elements don't have an order. That's pretty hard to believe; indeed, the value of an iterator is is specifically because the order of the elements is not specified; without that, there is no way to get all of the elements via their cursors (or indexes, if you prefer). > The index can be of the type System.Address, that is no matter. > But to be able to iterate is a contract on the container. It is IMO a very > bad idea to assume all containers to fulfill this contract. I would never want to say *never* (there is always a counter-example), but surely all of the classic containers (including a "bag") need iteration. It's true that the implementation of a "bag" will necessarily impose an order on the elements, but that order is not interesting and shouldn't be considered part of the abstraction. But the ability to get all elements of a bag for processing is a fundamental operation of the container. Randy.