comp.lang.ada
 help / color / mirror / Atom feed
* Trait based containers
@ 2018-05-05  8:43 Luke A. Guest
  2018-05-05 16:03 ` Jere
  2018-05-07  7:00 ` briot.emmanuel
  0 siblings, 2 replies; 5+ messages in thread
From: Luke A. Guest @ 2018-05-05  8:43 UTC (permalink / raw)


I thought this was being submitted for inclusion into Ada 202X?

What’s happening with this?

Luke 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trait based containers
  2018-05-05  8:43 Trait based containers Luke A. Guest
@ 2018-05-05 16:03 ` Jere
  2018-05-07  7:02   ` briot.emmanuel
  2018-05-07  7:00 ` briot.emmanuel
  1 sibling, 1 reply; 5+ messages in thread
From: Jere @ 2018-05-05 16:03 UTC (permalink / raw)


On Saturday, May 5, 2018 at 4:43:41 AM UTC-4, Luke A. Guest wrote:
> I thought this was being submitted for inclusion into Ada 202X?
> 
> What’s happening with this?
> 
> Luke

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trait based containers
  2018-05-05  8:43 Trait based containers Luke A. Guest
  2018-05-05 16:03 ` Jere
@ 2018-05-07  7:00 ` briot.emmanuel
  1 sibling, 0 replies; 5+ messages in thread
From: briot.emmanuel @ 2018-05-07  7:00 UTC (permalink / raw)


On Saturday, May 5, 2018 at 10:43:41 AM UTC+2, Luke A. Guest wrote:
> I thought this was being submitted for inclusion into Ada 202X?
> What’s happening with this?

I am the original developer for those experimental containers. This was mostly a way
to explore the use of generics in various contexts, and they resulted in a few (I believe
3, though I forgot exactly) new AI submitted to the ARG. Those AI are not about that
library itself, but about various improvements to the language to better support this
kind of generic packages.

I don't think we ever wanted to integrate them into the language. Indeed, Ada already has its own set of containers, so it would be a hard sell to provide a second set of containers.

Instead, the intent was for AdaCore to base its implementation of the standard Ada containers on something like the traits containers, for better code sharing among other things, and maybe also to provide the traits containers as an independent library (I think this is better, as someone else will come with a better implementation/design at some point, so better if it isn't hard-coded in the RM).

Then the SPARK people took interest in those as well, since, as opposed to the Ada containers, they provide a good basis for SPARK-compatible containers. Claire Dross did a huge amount of work to make the containers provable (not proven, this isn't the same thing).

There were quite a few limitations in Ada that made those containers somewhat hard to use for final users. In particular, instantiating the containers is somewhat tricky, especially if you want to control all the details (if you use one of the high-level packages, this is very similar to instantiating Ada's own containers).

Then I left AdaCore...

At this point, I don't think there's anyone working on those containers from the pure Ada library standpoint. I hope that the SPARK people still have an interest in a subset of them, but I must admit I have no internal knowledge of this.

In my new company, we use a lot of similar constructs, and in the process discovered a lot of compiler bugs, mostly related to the use of constructs like expression functions, for..of loops, and others.

It would be nice if there was still interest in that library. The code is all accessible in github, and I believe the license is GPL


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trait based containers
  2018-05-05 16:03 ` Jere
@ 2018-05-07  7:02   ` briot.emmanuel
  2018-05-07  7:14     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 5+ messages in thread
From: briot.emmanuel @ 2018-05-07  7:02 UTC (permalink / raw)


> 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Trait based containers
  2018-05-07  7:02   ` briot.emmanuel
@ 2018-05-07  7:14     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry A. Kazakov @ 2018-05-07  7:14 UTC (permalink / raw)


On 07/05/2018 09:02, briot.emmanuel@gmail.com wrote:

> 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.

The main purpose of iteration is not to use keys and thus to avoid to 
the overhead of key-to-element mapping and, possibly, the volatility of 
keys.

Actually in most cases there should no iterators at all but an array 
view of the container instead. Iterators is a necessary evil of 
half-containers like lists, graphs etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-07  7:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-05  8:43 Trait based containers Luke A. Guest
2018-05-05 16:03 ` Jere
2018-05-07  7:02   ` briot.emmanuel
2018-05-07  7:14     ` Dmitry A. Kazakov
2018-05-07  7:00 ` briot.emmanuel

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