On Wed, Dec 18, 2013 at 3:32 PM, Ѓорѓи Ќосев <[email protected]> wrote:

> I understand that adding branding to promises is impossible at this
> point, as it would break backward compatibility with all existing
> implementations.
>

That wasn't the overriding consdieration. I don't care if we don't have
a-priori compatibility. The bigger issue is the lack of symbol
infrastructure in the language and the inability to polyfill if we do. I've
long argued for "ghetto branding" (something less foot-gun-ish than an
extractable then callable), but in the interest of harmony, was not willing
to fight for the better design at the end.

Our primary goal here needs to be shipping something ASAP. All other
concerns are, in the scheme of things, irrelevant.'

We're already half a year late on this.


> However, thenable assimilation could still be made slightly less sad by
> doing something very similar to branding, without breaking backward
> compatibility.
>
> The assimilation procedure could check if the thenable has a property
> that brands it non-assimilatable, e.g. __notPromise__ If such a property
> exists and is set to true, it will not assimilate it.
>
> While far from perfect, this will at least allow objects from existing
> libraries that have a .then method to coexist with promises without
> forcing library authors (and users) to massively refactor their code.
> Authors would only need to add the flag __notPromise__ to their
> prototypes - all other existing code will continue to work normally.
>
> I believe this would be better than globally banning such a generic name
> like `.then` as a method.
>
> As a bonus, statis analysis tools could possibly warn users to
> explicitly add `__notPromise__ = false;` (i.e. they could advise users
> to explicitly express intent WRT to assimilation)
>
> Does this sound like a good idea?
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to