Hi Valery, Great you’re looking into this :)
I’ve also recently started working on some more support for ES6. One of the first things from my side will probably be support for Symbol, as that is a basis for quite a bit of the other functionality. On 8 Feb 2018, at 10:39, Valery Kotov <[email protected]<mailto:[email protected]>> wrote: 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”? No, IsCallable(x) basically means that x is a FunctionObject. As far as I understand the test case you quote above, it implies that the code snippet will throw a TypeError, in line with chapter 25.4.1.4 point 8 and 9 of the spec. 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-iscallablehttps://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 IsCallable(undefined) is false, simply because it’s not an Object. The argument also needs a [[Call]] internal slot, which is only the case for FunctionObject’s. 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! With the above, I don’t think there’s a contradiction. Hope this helps you further. Let me know when you want me to have a closer look at your patches and review them. Cheers, Lars Sincerely yours, Valery Kotov _______________________________________________ Development mailing list [email protected]<mailto:[email protected]> http://lists.qt-project.org/mailman/listinfo/development
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
