Proposal: Collection Literals
markmahieu at googlemail.com
Mon Mar 30 23:49:20 PDT 2009
Are you referring to the idea that a reified collections API may have to be
separate from (and not directly compatible with) the current one?
2009/3/31 Neal Gafter <neal at gafter.com>
> On Mon, Mar 30, 2009 at 5:45 PM, Joshua Bloch <jjb at google.com> wrote:
> > Could you please be a be a bit more specific? In particular, could you
> > provide an example of something that this proposal precludes but the
> > for-each construct (which is already in the language) does not? Once we
> > have such an example, we'll be able to weigh the pros and cons
> > intelligently.
> Sure. As the proposed construct is defined to create non-reified
> collection types, and that distinction may be highly visible to
> programmers, programs using the proposed syntax would have to continue
> creating non-reified collections.
> With the for-each loop, on the other hand, the only object created by
> the construct is an iterator. The iterator is constructed by a
> library method that is completely under control of the Iterable that
> comes in, and hidden from code containing the for-each loop. While
> non-reified types might continue to produce non-reified iterators,
> reified classes may well produce reified iterators.
More information about the coin-dev