On "A New Collections Framework for the Standard Library"
Jack Stouffer via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 18 08:18:00 PDT 2017
I just got around to watching Eduard Staniloiu's talk at DConf
[1] about the collections library he was working on. One thing
seemed odd, in that Eduard seems to be saying that the container
and the range over the container's elements are one in the same
and the range primitives are on the container itself.
Is this accurate?
If so, then this is completely different than the currently
accepted design of ranges and containers. Currently, a container
allows the removal and insertion of elements, and to get a range
of the elements you have to call a function or slice the
container. This is how std.containers and Brain's EMSI container
library. In this new library, what happens when I iterate the
elements of one of these containers using foreach? Do the range
primitives empty the container? How do I ask for a new, full
range of my data in the collection to use in a range algorithm
after I've already iterated over the elements?
As Andrei originally laid out in this talk introducing ranges
[2], ranges only shrink and never grow. Put another way, Output
Ranges and Input Ranges are two separate things. Andrei states
durning that talk (at 1:20:20)
"Can ranges ever grow? ... No, never, because it would be
fundamentally unsafe."
I'm not sure what Andrei meant by this, but he believes that
growing ranges is also a bad idea.
[1] https://www.youtube.com/watch?v=k88QSIC-Na0
[2]
https://archive.org/details/AndreiAlexandrescuKeynoteBoostcon2009
More information about the Digitalmars-d
mailing list