Hi,

In ES5 11.4.3, which defines the semantics of typeof, is written that
native objects (as proxies will be since they'll be within the scope of
the spec) which do not implement a [[call]] trap should return "object"
with typeof.
Currently, the proxy spec doesn't separate the case when the call trap
is defined or not.

Does not defining the call trap mean that [[call]] isn't implemented or
does it mean that it is defined to a stub method?

In FF4b10, here are a couple of results:
> typeof Proxy.createFunction({}, function(){}, function(){});
"function"

> typeof Proxy.createFunction({}, function(){}, null);
TypeError: null is not a function

> typeof Proxy.createFunction({}, function(){}, undefined);
TypeError: undefined is not a function

> typeof Proxy.createFunction({}, function(){});
"function"
(Is this inconsistent with passing explicitely undefined?)

> typeof Proxy.createFunction({}, undefined);
TypeError: undefined is not a function

> typeof Proxy.createFunction({}, null);
TypeError: null is not a function

> typeof Proxy.createFunction({});
TypeError: createFunction requires more than 1 argument


In order to allow more flexibility, I would suggest to allow
undefined/null as allowed values in order to not define either the
[[call]] or [[construct]] internal method. This would obivously allow to
create function proxies with a [[Construct]] but no [[Call]]. The ES5
spec would say that this is an "object". However, since there is no such
case (native objects with [[Construct]] but no [[Call]]) that I am aware
of, would it make sense to add a value ("constructor"?) for such cases?

Cheers,

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

Reply via email to