<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Valery,
<div class=""><br class="">
</div>
<div class="">Great you’re looking into this :)</div>
<div class=""><br class="">
</div>
<div class="">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.<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 8 Feb 2018, at 10:39, Valery Kotov <<a href="mailto:kotov.valery@gmail.com" class="">kotov.valery@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">Dear all,<br class="">
<br class="">
I'm working on JS Promise implementation: <a href="https://codereview.qt-project.org/#/c/122066/" class="">
https://codereview.qt-project.org/#/c/122066/</a><a href="https://codereview.qt-project.org/#/c/122066/" class="">https://codereview.qt-project.org/#/c/122066/</a><br class="">
<br class="">
</div>
I also would like the implementation to pass official <a href="https://github.com/tc39/test262" class="">
ECMAScript test suite</a>. Though I faced some difficulty to understand certain test cases.<br class="">
<br class="">
</div>
E.g. notion of "IsCallable" seems to be a bit unclear to me.<br class="">
<br class="">
It is stated <a href="https://github.com/tc39/test262/blob/master/test/built-ins/Promise/all/capability-executor-not-callable.js" class="">
here:</a><br class="">
"<span class="gmail-pl-c">8. If IsCallable(promiseCapability.[[Resolve]]) is false, throw a TypeError exception.</span>"<br class="">
"<span class="gmail-pl-c">9. If IsCallable(promiseCapability.[[Reject]]) is false, throw a TypeError exception.</span>"<br class="">
<br class="">
</div>
<div class="">Presumably the statement is supposed to be proved by test cases in the file. E.g.<br class="">
var checkPoint = "";<br class="">
assert.throws(TypeError, function() {<br class="">
  Promise.all.call(function(executor) {<br class="">
    checkPoint += "a";<br class="">
    executor(undefined, undefined);<br class="">
    checkPoint += "b";<br class="">
  }, []);<br class="">
}, "executor called with (undefined, undefined)");<br class="">
assert.sameValue(checkPoint, "ab", "executor called with (undefined, undefined)");<br class="">
<br class="">
</div>
<div class="">The conclusion I could make looking at this, both check points should pass and no exception should be raised during "executor(undefined, undefined)" call.
<br class="">
But does that mean "IsCallable(undefined) === true”?<br class="">
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
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.</div>
<div><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">Which is a bit confusing, sine one could get completely opposite conclusion for example from the test
<a href="https://github.com/tc39/test262/blob/da4f4385fdf88ff2c8acf036efaaa62f8cd6bd58/test/built-ins/Set/prototype/forEach/callback-not-callable-undefined.js" class="">
here</a>.<br class="">
</div>
<div class="">To be honest, ECMAScript spec does not seem to be very helpful as well since notion of callable object is a bit vague:
<a href="https://www.ecma-international.org/ecma-262/8.0/index.html#sec-iscallable" class="">
https://www.ecma-international.org/ecma-262/8.0/index.html#sec-iscallable</a><a href="https://www.ecma-international.org/ecma-262/8.0/index.html#sec-iscallable" class="">https://www.ecma-international.org/ecma-262/8.0/index.html#sec-iscallable</a><br class="">
Also, unfortunately, I could not find clear answer in official tests for "undefined":
<a href="https://github.com/tc39/test262/tree/da4f4385fdf88ff2c8acf036efaaa62f8cd6bd58/test/built-ins/undefined" class="">
https://github.com/tc39/test262/tree/da4f4385fdf88ff2c8acf036efaaa62f8cd6bd58/test/built-ins/undefined</a>
<br class="">
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
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.</div>
<div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">It feels a bit like a contradiction. Thus, I'm a bit puzzled how to go about it. Am I missing something?<br class="">
</div>
<div class="">I would appreciate some help or hints!</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
With the above, I don’t think there’s a contradiction. Hope this helps you further.</div>
<div><br class="">
</div>
<div>Let me know when you want me to have a closer look at your patches and review them.<br class="">
<div><br class="">
</div>
<div>Cheers,</div>
<div>Lars</div>
<div><br class="">
<blockquote type="cite" class="">
<div dir="ltr" class=""></div>
</blockquote>
</div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="gmail_signature">
<div dir="ltr" class=""><font color="#666666" class="">Sincerely yours,</font>
<div class=""><font color="#666666" class="">Valery Kotov</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
Development mailing list<br class="">
<a href="mailto:Development@qt-project.org" class="">Development@qt-project.org</a><br class="">
http://lists.qt-project.org/mailman/listinfo/development<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>