Dear all,

I'm working on JS Promise implementation:
https://codereview.qt-project.org/#/c/122066/
https://codereview.qt-project.org/#/c/122066/

I also would like the implementation to pass official ECMAScript test suite
<https://github.com/tc39/test262>. Though I faced some difficulty to
understand certain test cases.

E.g. notion of "IsCallable" seems to be a bit unclear to me.

It is stated here:
<https://github.com/tc39/test262/blob/master/test/built-ins/Promise/all/capability-executor-not-callable.js>
"8. If IsCallable(promiseCapability.[[Resolve]]) is false, throw a
TypeError exception."
"9. If IsCallable(promiseCapability.[[Reject]]) is false, throw a TypeError
exception."

Presumably the statement is supposed to be proved by test cases in the
file. E.g.
var checkPoint = "";
assert.throws(TypeError, function() {
  Promise.all.call(function(executor) {
    checkPoint += "a";
    executor(undefined, undefined);
    checkPoint += "b";
  }, []);
}, "executor called with (undefined, undefined)");
assert.sameValue(checkPoint, "ab", "executor called with (undefined,
undefined)");

The conclusion I could make looking at this, both check points should pass
and no exception should be raised during "executor(undefined, undefined)"
call.
But does that mean "IsCallable(undefined) === true"?

Which is a bit confusing, sine one could get completely opposite conclusion
for example from the test here
<https://github.com/tc39/test262/blob/da4f4385fdf88ff2c8acf036efaaa62f8cd6bd58/test/built-ins/Set/prototype/forEach/callback-not-callable-undefined.js>
.
To be honest, ECMAScript spec does not seem to be very helpful as well
since notion of callable object is a bit vague:
https://www.ecma-international.org/ecma-262/8.0/index.html#sec-iscallable
https://www.ecma-international.org/ecma-262/8.0/index.html#sec-iscallable
Also, unfortunately, I could not find clear answer in official tests for
"undefined":
https://github.com/tc39/test262/tree/da4f4385fdf88ff2c8acf036efaaa62f8cd6bd58/test/built-ins/undefined

It feels a bit like a contradiction. Thus, I'm a bit puzzled how to go
about it. Am I missing something?
I would appreciate some help or hints!

Sincerely yours,
Valery Kotov
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to