On 24 May 2013 18:55, Tab Atkins Jr. <[email protected]> wrote: > I simply don't understand why Javascript's Map apparently makes this > impossible, forcing all Maps to be any->any, and offering only hacks > (admittedly clever ones) that partially work if you want a restricted > type.
I haven't really followed this thread, but could it be that you are confusing polymorphic instantiation with subtyping here? A Map(String, String) is an instance of a polymorphic Map(A, B), but it is not a subtype of Map(Any, Any), because a map is contravariant in its key type. That's why the subclassing you have in mind does not really make sense from a subtyping perspective. If you want to restrict it, then you'd have to do so by wrapping, not by inheritance. /Andreas _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

