Closed domenic closed 8 years ago
@domenic thanks a lot for getting this ready for stage 3, it is simple enough and small enough IMO. My only comment is about HostPrepareImportedModule
, I think the name is misleading, I got confused at first. I guess I was associating it with HostResolveImportedModule
but they are very different. I don't have an actual recommendation to name it, but it is something that we should probably look at.
👍
Btw: it is also the first time we have an abstract operation in 262 using NewPromiseCapability
aside from the promise API definition itself :)
Awesome! Filed #18 to discuss the name. Much appreciated!
Overall looks good. A few comments (and apologies if there are dumb questions in here, it's my first time reviewing one of these specs to the extent required by stage 3):
ToString
call results in a rejected promise. I would have expected a failed ToString
to throw immediately just the same. Is your intuition that the ToString operation is happening "inside" the function body of import
? This distinction seems unimportant to me, given that import()
isn't really a function call anyway, but I could be convinced.How feasible would it be to include all such modifications before the meeting? Presumably that work will have to be done at some point.
Happy to do that. It's pretty mechanical Ctrl+Fing, but I can indeed list them.
(oops, commented too soon)
Is your intuition that the ToString operation is happening "inside" the function body of import? This distinction seems unimportant to me, given that import() isn't really a function call anyway, but I could be convinced.
This is exactly the intuition. In particular,
import((() => { throw new Error(); })()).then(() => { });
should behave the same as
const arg = (() => { throw new Error(); })();
import(arg).then(() => { });
i.e. it should throw immediately at the call site. But the argument processing, just like any other invalid argument, should cause a rejected promise. I can see how it's a bit different for a syntactic form, but I think we should treat it more like a function than not. The same argument about not wanting to duplicate error-handling logic between catch (e) { ... }
and .catch(e => ...)
applies.
Overall this looks solid. Other than the fact that Node.js would currently have difficulty performing the module loading completely asynchronous, it should be possible to abstract away that limitation behind the Promise interface so that there is little real impact on the actual code beyond performance. The fact that this would be limited to Script and Module Records is ++.
Pinging @bmeck for his input.
Added the missing static semantics. It turns out there were only three locations where it needed to be added, so I am glad @ajklein prompted me to do so.
Reviewers should be made aware that there have been some structural changes as a result of discussions in #24, which make the previously-imprecise "asynchronous completion value" mechanisms much more precise. This has changed a decent amount of the text, but hasn't really made any normative changes, so hopefully your reviews are still valid :). See https://github.com/tc39/proposal-dynamic-import/commit/b8de8717b67e0c9b46fe29b4ae324cb9bbc00084 for the changeset.
Feedback:
Signing off, though curious to see where Allen is going with the operator formulation.
Thanks @bterlson! I took care of all of those, except I think "i.e. is not null" is still valuable since it makes it clear why we're doing the assert, IMO.
Would you argue that all asserts should say "(i.e.
No, just in the cases where you look at it and go "that's weird; what else could it possibly be?" To me it's a little surprising that GetActiveScriptOrModule() could return anything but a Script or Module so I found the i.e. helpful.
I think the functionality described by this proposal is a good idea but there are still issues that I think need to be resolved before it is ready for Stage 3.
import
operator instead of a pseudo call-like syntax. There are reasonable pro/con arguments for each approach. A choice needs to be made by TC39 consensus prior to advancing the proposal.Thanks @allenwb! I agree we need to resolve #23 and, if there is an actual attack, #26, before proceeding. I think those will be resolved at the meeting. For #24, I personally think the current spec text is good to go, but if you're concerned about implementations not being able to understand its semantics correctly, I'd love to hear from any implementers with concerns.
Note that I removed the check next to my name. I have completed my review but I have not unconditionally said that it should advance to stage 3.
That's fine. The check is meant to signify the completion of review, but I'm happy to let you check or uncheck the boxes as desired.
"sign off" is the questionable language.
Here are the people who have signed up as reviewers for this spec that need to sign off before it can get to stage 3, per the notes:
And of course the editor:
Also, we have one "unofficial reviewer" whose feedback would be welcome:
Useful resources, perhaps: