Except http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html.
/be
Till Schneidereit wrote:
I'm beginning to like a conditional option on [[Invoke]].
Consider: [[Invoke]](P, ArgumentsList, Receiver, conditional=false)
If conditional is false, it works just like the current [[Invoke]]
spec.
If conditional is true and the [[Get]] value is not callable (this
includes undefined for a missing property) result is: [false,
[[Get]] result].
if conditional is true and the [[Get]] value is callable, result
is [true, value returned from [[Call]]
The conditional form would only be used in odd cases like the
toJSON call.
ES code can accomplish the same thing via Reflect.invoke with true
as the 4th argument.
I like it. This gets around the issue of distinguishing a return value
of `undefined` from "no callable property with that name found" and
would be easy to implement for proxies, too.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss