domenic / promises-unwrapping

The ES6 promises spec, as per September 2013 TC39 meeting
1.24k stars 95 forks source link

Should we use the new Invoke trap? #25

Closed domenic closed 11 years ago

domenic commented 11 years ago

http://esdiscuss.org/topic/invoke-and-implicit-method-calls

annevk commented 11 years ago

When I brought this up with Allen, he was okay with not everything mapping to [[Invoke]]. Seemed weird to me to have a non-primitive as trap.

annevk commented 11 years ago

I guess most traps are non-primitives in a way.

erights commented 11 years ago

@domenic We should only use [[Invoke]] for unconditional method calls. It is only observable when the unconditional method call is to an object whose type is not already known by the logic of the promise spec, such that it might be a proxy. Note that invoking a thenable's .then doesn't apply because that isn't unconditional, so it must be coded as a [[Get]] followed by a [[Call]] anyway. Invoking a known-promise's .then using [[Invoke]] is perhaps good style, but isn't observably different since we know it isn't a proxy.

So where would this make an observable difference? If none, we can leave the stylistic cleanup to tc39 separately, since it would cause no incompatibility with this spec.

@annevk Yes, primitive traps are known as "fundamental traps". The others are known as "derived traps".

domenic commented 11 years ago

@erights yeah, but the linked es-discuss thread keeps floating ideas for some new trap or similar that handles the conditional invocation case. I guess we could close this pending any outcome there.

erights commented 11 years ago

Yes. I just had a long chat with @tvcutsem and we convinced each other that the status quo on [[Invoke]] is superior to all the alternative discussed on es-discuss as well as all the alternatives we privately discussed. This doesn't mean it is settled yet. Tom will be making our arguments soon on es-discuss. But let's assume the status quo on [[Invoke]] until a dramatic surprise to the contrary.

erights commented 11 years ago

Given that [[Invoke]] is assumed to be only unconditional, in the absence of any observable difference, I am closing this.

erights commented 11 years ago

https://mail.mozilla.org/pipermail/es-discuss/2013-September/033400.html