Proposal: Collection Literals

Neal Gafter neal at gafter.com
Tue Mar 31 07:42:16 PDT 2009


Your guesses are about future design decisions.  We shouldn't make
assumptions about future design decisions without doing the future
design now, and I don't believe we are in a position to do so.  In any
case, some contexts will have the type parameters reified and some
will not, so the future spec for this feature cannot uniformly require
the creation of reified collections, even if doing so were compatible
with its previous non-reified-only behavior.

On Tue, Mar 31, 2009 at 7:34 AM, Reinier Zwitserloot
<reinier at zwitserloot.com> wrote:
> First off: WANT!
>
> Second:
>
> Whichever form Reified Lists/Sets/Maps eventually take, won't they
> neccessarily extend List<FOO> and friends? I imagine that any attempt to
> create:
>
> public interface ReifiedList<reified T> {}
>
> involves making that type implement List<T>, eventhough treating your
> reified list as a List<T> would no longer give you the benefit of
> reification, possibly.
>
> Therefore, what we seem to be talking about, if I'm right so far (and I'm
> just taking a stab at this here, please correct me if I'm wrong!), is that
> we specify that the collection literals return some implementation of
> List<T>, Set<T>, and Map<K, V>, with listed behaviours (specifically,
> 'linked' behaviour for maps and sets, otherwise nothing special), but that
> in a future version, we may change this to: They will return ReifiedList,
> ReifiedSet, and ReifiedMap, all of which extend List, Set, and Map.
>
>
> How is that not backwards compatible?
>
>
>  --Reinier Zwitserloot
>
>
>
> On Mar 31, 2009, at 10:51, Joshua Bloch wrote:
>
>> Mark,
>> Presumably you'd be happy to replace them with lists of sets, and then you
>> could use (nested) collection literals?
>>
>>       Josh
>>
>> On Tue, Mar 31, 2009 at 1:47 AM, Mark Thornton
>> <mthornton at optrak.co.uk>wrote:
>>
>>> Joshua Bloch wrote:
>>>
>>>> Neal,
>>>>
>>>> In other words, we could prohibit set literals in array initializers.
>>>> Arrays of sets are an awful idea anyway, so it's no great loss.
>>>>
>>> Ouch, I have a few of those. Invariably where the universe of unique sets
>>> is very small and the array contains all of them.
>>>
>>> Regards,
>>> Mark Thornton
>>>
>>
>
>



More information about the coin-dev mailing list