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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,443dd11dd1cfaec9 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.75.8 with SMTP id y8mr166448wiv.4.1344571551023; Thu, 09 Aug 2012 21:05:51 -0700 (PDT) Path: n2ni53786789win.0!nntp.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!border2.nntp.ams2.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feed.xsnews.nl!border-2.ams.xsnews.nl!news.panservice.it!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Abstraction over container iterators Date: Fri, 3 Aug 2012 14:52:24 +0200 Organization: cbb software GmbH Message-ID: References: <75425fa8-7885-48d8-9eeb-8f90a1bfb128@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 9A8bJrx4NhDLcSmbrb6AdA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-08-03T14:52:24+02:00 List-Id: On Fri, 3 Aug 2012 05:01:41 -0700 (PDT), ms wrote: > What we have here is an example package fairly well illustrating my > problem. I'm storing some environment variables in Hashed_Map, but I want > to build a abstraction layer over the standard container, so I can in > future change the underlaying container without changing any code in my > package's customers. > > Getting and setting variables is easy - as declared above. The real > problem is iterating. I'd like to let my package's customers to iterate > over the environment and get both key and value for each element easily. Add the iteration abstraction to the package. The implementation would both do both the container and the iterator. > As I'm using Ada 2012 the best way would be to use iterators, I prefer plain indices over iterators. Just have get/put an element by its positive index. Most containers should have array interface. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de