On Mon, Nov 19, 2012 at 9:46 PM, Brendan Eich <bren...@mozilla.com> wrote:
> Tab Atkins Jr. wrote:
>> If we did this, the only reason to continue subclassing Map is to get
>> instanceof checks to work.  Is this acceptable?
>
> I think it's either irrelevant (no one tests 'aUrlQuery instanceof Map') or 
> else a potential problem (cross-frame instanceof).

People *do* perform those checks, though.  For example, in a method
that accepts either an array or other things, a quick "foo instanceof
Array" check is a clear, easy way to check what you've got. It suffers
from cross-frame issues, but shrug.  Similar checks will proliferate
as people write methods that take generic Maps.

(On the other hand, they might instead just feature-test for the
existence of items(), and then use it as an iterable, in which case
this would be a non-issue.  Depends on the use-case, I suppose.)


> Where I would like to go, if you force me to pick a promising path:
>
> http://disnetdev.com/contracts.coffee/#duck
> http://disnetdev.com/blog/2011/09/05/Duck-Typing-Invariants-In-contracts.coffee/

That's my preferred direction, too, but I suspect that's far off.  It
doesn't even have a strawman yet, does it?

~TJ
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to