Proposal: Collection Literals

Marek Kozieł develop4lasu at gmail.com
Tue Mar 31 00:15:04 PDT 2009


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

Don't you think that "non-reified types" should be able to produce
both types of iterators?

-- 
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list