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

Document microtasks #2142

Open
kwalrath opened this issue Nov 27, 2019 · 6 comments
Open

Document microtasks #2142

kwalrath opened this issue Nov 27, 2019 · 6 comments
Labels
a.language Relates to the Dart language tour co.request Community ask for documentation e2-days Can complete in < 5 days of normal, not dedicated, work e3-weeks Complete in < 4 weeks of normal, not dedicated, work from.team Reported by Dash docs team member p2-medium Necessary but not urgent concern. Resolve when possible. st.triage.ltw Indicates Lead Tech Writer has triaged

Comments

@kwalrath
Copy link
Contributor

With the disappearance of the out-of-date article "The Event Loop and Dart", we no longer have any doc on dart.dev for microtasks. Microtasks are mentioned in /articles/archive/zones, but that article, too, is out of date.

The scheduleMicrotask API docs point to the old event loop article (/articles/event-loop, which is forwarded to the Medium article made from Andrew's event loop video). It'd be good to have actual coverage of the event loop and microtasks somewhere on dart.dev, and to redirect /articles/event-loop to that coverage.

@kwalrath kwalrath added p2-medium Necessary but not urgent concern. Resolve when possible. e2-days Can complete in < 5 days of normal, not dedicated, work e3-weeks Complete in < 4 weeks of normal, not dedicated, work co.request Community ask for documentation labels Nov 27, 2019
@kwalrath
Copy link
Contributor Author

kwalrath commented Jan 23, 2020

Interim fix: add link from Andrew's event loop article to an archive URL like https://web.archive.org/web/20170704074724/https://webdev.dartlang.org/articles/performance/event-loop.

DONE

@kwalrath kwalrath assigned kwalrath and unassigned kwalrath Jan 23, 2020
@kwalrath
Copy link
Contributor Author

I've just discovered an internal resource that seems helpful: go/dart-await. It refers to this DartPad and this article.

@kwalrath
Copy link
Contributor Author

kwalrath commented Feb 1, 2022

There's a new concurrency page, but it doesn't cover microtasks: https://dart.dev/guides/language/concurrency

@terryl1900
Copy link

Hi @kwalrath , searching "dart event loop" on Google, the first result is https://dart.cn/articles/archive/event-loop, which is the same as the archive URL you mentioned above.

While waiting for someone to create an updated doc, I'm curious if you know whether these points in the old doc are still true:

Fun facts about Future:

1. The function that you pass into Future’s then() method executes immediately when the Future completes. (The function isn’t enqueued, it’s just called.)
2. If a Future is already complete before then() is invoked on it, then a task is added to the microtask queue, and that task executes the function passed into then().
3. The Future() and Future.delayed() constructors don’t complete immediately; they add an item to the event queue.
4. The Future.value() constructor completes in a microtask, similar to #2.
5. The Future.sync() constructor executes its function argument immediately and (unless that function returns a Future) completes in a microtask, similar to #2.

@parlough
Copy link
Member

@lrhn Would you be able to provide some input on @terryl1900's questions? We could also use your responses as guidelines when creating any new documentation around this. Thanks :)

@atsansone atsansone added a.language Relates to the Dart language tour st.triage.ltw Indicates Lead Tech Writer has triaged labels Apr 6, 2023
@atsansone atsansone added the from.team Reported by Dash docs team member label Aug 21, 2023
@dkbast
Copy link
Contributor

dkbast commented Jan 25, 2024

I believe the mentioned bugs in the article have been fixed - when running the examples they now show in the expected order (which is a bit different from what was 'then' true) - right now we are missing a good writeup on the event loop, it's also difficult to find the implementation in C, which is something I was trying to get to (the JS event loop is quite easy to find)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a.language Relates to the Dart language tour co.request Community ask for documentation e2-days Can complete in < 5 days of normal, not dedicated, work e3-weeks Complete in < 4 weeks of normal, not dedicated, work from.team Reported by Dash docs team member p2-medium Necessary but not urgent concern. Resolve when possible. st.triage.ltw Indicates Lead Tech Writer has triaged
Projects
None yet
Development

No branches or pull requests

5 participants