comp.lang.ada
 help / color / mirror / Atom feed
From: briot.emmanuel@gmail.com
Subject: Re: Trait based containers
Date: Mon, 7 May 2018 00:02:34 -0700 (PDT)
Date: 2018-05-07T00:02:34-07:00	[thread overview]
Message-ID: <fa962e1b-eaa1-416f-886f-0dcb0d4e359f@googlegroups.com> (raw)
In-Reply-To: <3de7cff3-9cfa-44bc-b837-5048bd813802@googlegroups.com>

> I'm not sure either, but I hope they revert the changes to Map iterators
> if they do add it to Ada202x.  I'm not sure why they changed it to iterate
> over the keys instead as that seems like the least useful way to iterate
> over a map, and you could still access keys via the cursor.  Now the less
> useful way is the default.

One of the main principle in the design of that library is that people could
change most of the details. For instance, if you do not like the default
iterator that returns a key, you can easily derive your own that returns an
element instead.

Initially, I had wanted to return a tuple (key, element) directly. This is really
what a cursor is. So instead of doing

    for A of Map loop

you do

   for C in Map.Iterate loop

and you get both key and element.

I prefer to return a key in the "for..of" loop case, because with a map you
can always go from key->element. The opposite might not  be true.


  reply	other threads:[~2018-05-07  7:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-05  8:43 Trait based containers Luke A. Guest
2018-05-05 16:03 ` Jere
2018-05-07  7:02   ` briot.emmanuel [this message]
2018-05-07  7:14     ` Dmitry A. Kazakov
2018-05-07  7:00 ` briot.emmanuel
replies disabled

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