Indexing access for Lists and Maps considered harmful?

Neal Gafter neal at gafter.com
Tue Jun 23 22:55:54 PDT 2009


On Tue, Jun 23, 2009 at 6:39 PM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:

> I agree to the theory of your post, but, so what?
>
> Java is not going to be perfect unless java is willing to sacrifice
> backwards compatibility, which it isn't. So, perfection can't be the goal -
> because if it is, then no language change is ever going to make it in, and
> paradoxically, that really brings java no closer to perfection.


So you're saying that because Java isn't perfect, we shouldn't bother trying
for the best possible evolution of the language?  Or do you really believe
that the constraint of backward compatibility precludes a solution that
satisfies all of our requirements?  You've explored a small part of the
design space involving the addition of new interfaces and found no solution
that satisfies the requirements.  Do you conclude therefore that a good
solution doesn't exist?  I've explored a slightly larger design space and
found a few perfectly acceptable solutions that appear to satisfy all of our
design criteria, but using different techniques than the ones you
considered.  My favorite solution is a combination of specification by
syntactic translation and the addition of support for extension methods.  It
can be retrofitted onto any existing class or interface without breaking
backward compatibility, and can be defined to have precisely the necessary
semantics to match the JLS specification for assignment.


> NB: I'd hereby like to repeat my suggestion to choose pragmatism over
> perfection here:


Sure, if there were a conflict between the two (there isn't) that would be
reasonable.  Adding direct support for the collection interfaces to the JLS
isn't a reasonable approach either.

Cheers,
Neal



More information about the coin-dev mailing list