Proposal: Collection Literals
Reinier Zwitserloot
reinier at zwitserloot.com
Tue Mar 31 07:34:11 PDT 2009
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