Please ponder: how similar are sequences and mappings?
- Hi, everyone.
I thank you all for your participation and for contributing your
ideas on the issues surrounding iterators.
I'm collecting some of the points made in this discussion and
extracting important issues to be discussed in the upcoming BOF.
In particular, there is a strong recurring theme driving many of
the comments i've seen here: the feeling that sequences and mappings
should "feel" or "behave" in similar ways to some degree, as both
are containers. But i want to ask: just how similar should they be?
- More similarity fosters code reuse. Greg's examples show that
with appropriate adjustments, it could be made more convenient
to write a function that iterates over an object-that-could-be-
- Less similarity fosters type safety. The more distinctly we
treat sequences and mappings, the less likely we are to get
mixed up when using them. Such distinctness also makes it
easier to tell what is expected by a chunk of code at a quick
glance just by the "look" of the code.
To those of both opinions, i present a challenge to come up with
supporting *real-life* cases.
I think it would be good to give this some careful thought before
coming to the meeting, so we have some insights to share. I hope
we can eventually come to some agreement on this philosophical point,
as it seems to have heavy bearing on directing the rest of the
* * *
Personal position: i'm afraid i have to admit some bias toward the
latter. I have yet to see examples of real situations where the
ability to polymorphically iterate over a sequence-or-mapping-object
is truly profitable. (It would be great to see some. Greg? Raymond?)
I can empathize with the aesthetic motivation to make them look the
same, but i think we would really need a practical example to warrant it.
Thanks again to all,