Proposal: Collection Literals (original) (raw)
Neal Gafter neal at gafter.com
Tue Mar 31 07:42:16 PDT 2009
- Previous message: Proposal: Collection Literals
- Next message: Proposal: Collection Literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 and friends? I imagine that any attempt to create: public interface ReifiedList {} involves making that type implement List, eventhough treating your reified list as a List 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, Set, 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
- Previous message: Proposal: Collection Literals
- Next message: Proposal: Collection Literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]