Skip to content

Commit

Permalink
Clarify TLA behavior in the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Apr 1, 2024
1 parent 9552727 commit e52cdf3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,27 @@ Since `d` uses top-level await, `d` and its dependencies cannot be deferred:
- The initial evaluation will execute `b`, `e`, `d` and `a`.
- Later, the `c.value` access will trigger the execution of `f` and `c`.

This is equivalent to "transpiling" the `import defer * as c from "c"` declaration to:
- direct eager import declarations to its async transitive dependencies
- eager loading/linking of `c`
- lazy evaluation of `c`

```js
// import c's async transitive dependencies
import "d";
// load c without evaluating it.
loadAndLinkSync("c");
// evaluate on property access
const c = new Proxy({}, {
get(namespace, prop) {
const promise = evaluate("c");
assert(promise.[[Status]] === "fulfilled");
const namespace = promise.[[Value]];
return namespace[prop];
}
});
```

### Rough sketch

If we split out the components of Module loading and initialization, we could roughly sketch out the
Expand Down

0 comments on commit e52cdf3

Please sign in to comment.