Closed
Conversation
Member
Author
|
Replaced by #10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Marking as draft because this is quite handwavy and probably not fully correct (also, it does not support Evaluation or
export { a as b } from).It shows roughly what we would need to do for #5 (comment).
I actually don't think I like this approach. It introduces complexity both for engines and for developers reading code, because instead of looking at the files you are importing to figure out what's being filtered due to your import you need to look at their whole subtree.
Consider a cases like this:
flowchart TD A -->|"import { x } from"| B B -->|"export { x, y } from"| C C -->|"export { x, y } from"| D D -->|"export defer { x } from"| E D -->|"export defer { y } from"| F G -->|"import { y } from"| BAssume that A is already loaded. Today, when loading G, G will try loading its dependency, which gets resolved to an already loaded module B, and it has nothing else to do.
If we do this change, when loading F and finding its dependency B we would need to check:
yspecifier?yspecifier?yspecifier?Both for developers and engines it's good that these steps only happen when explicit: when they can look at
C's source and see that there is adefermarker that means "actually, here you need to do recursion". Given that since ES6export { ... } fromdoesn't need this extra recursion when importing already loaded modules, I don't think we should add it now.