Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

microtask timing does not have an escape hatch in the language? #97

Closed
ljharb opened this issue May 9, 2019 · 12 comments

Comments

Projects
None yet
2 participants
@ljharb
Copy link
Member

commented May 9, 2019

The implication of #95 (comment) is that without setTimeout or some other embedded-provided API, there’s no way to get to the next “tick” where the weak ref hasn’t had a chance to become null.

Am i misunderstanding? If not, what ecma262 mechanism will exist as part of this proposal to provide this?

@littledan

This comment has been minimized.

Copy link
Member

commented May 9, 2019

There is no plan to make a way to get the next "tick" in this proposal, but I don't understand why there should be. Lots of things in JavaScript tie in with the embedder to work. For example, SharedArrayBuffer relies on the embedder for the mechanism to share the ArrayBuffer.

@ljharb

This comment has been minimized.

Copy link
Member Author

commented May 9, 2019

In general, it seems like a bad precedent to follow that an ECMAScript compliant engine wouldn’t be mandated to provide functionality that’s essential to using other parts of the language.

@littledan

This comment has been minimized.

Copy link
Member

commented May 9, 2019

I don't understand how this is different from SharedArrayBuffer.

@ljharb

This comment has been minimized.

Copy link
Member Author

commented May 9, 2019

SAB doesn't make sense without threads, which can not be provided by an embedder. Weak holdings are already part of the language in the collections; i don’t see why WeakRef needs to rely on setTimeout and friends, nor why that’s a good thing if avoidable.

@littledan

This comment has been minimized.

Copy link
Member

commented May 10, 2019

WeakRef does not depend on setTimeout in any particular sense. I think we are having a miscommunication.

@ljharb

This comment has been minimized.

Copy link
Member Author

commented May 10, 2019

Then setTimeout shouldn’t need to be part of the examples to convey when GC happens? (or at least, should be paired with a language-only example of the same?)

@littledan

This comment has been minimized.

Copy link
Member

commented May 10, 2019

All JavaScript code interacts with the host, for example, to run it at all. I don't understand what the goal of this line of discussion is.

@ljharb

This comment has been minimized.

Copy link
Member Author

commented May 10, 2019

I’d like an example that runs on a host that implements nothing beyond what is mandated by ecma262.

@littledan

This comment has been minimized.

Copy link
Member

commented May 14, 2019

This doesn't seem like a property that ECMA-262 has. For example, what if I asked for an example that runs on a host that uses Atomics.wait with nothing beyond what is mandated by ecma262?

It's the host who decides when to schedule finalizer callbacks and when to clear the kept list. So if a host does all of its jobs in the same queue as Promises, then you can use Promise.resolve. Or, if it uses some other timing, then the host can expose functions that let programmers schedule work at that timing.

@ljharb

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

Thanks, it was not apparent to me that collection was permitted to occur alongside Promise jobs - perhaps I’ve been confused by thinking some html choices discussed in the repo were part of this proposal.

@littledan

This comment has been minimized.

Copy link
Member

commented May 14, 2019

@ljharb Does this resolve the issue? I'm happy to answer any further questions.

@ljharb

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

Yes, thanks.

To your earlier point, yes, i think that would have been a reasonable question to ask during the procession of Atomics, and I’ll try harder in the future to not fail to ask that question for future proposals.

@ljharb ljharb closed this May 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.