-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Improve implementation of example JobQueue
s
#4111
Conversation
Test262 conformance changes
|
7b7e8b3
to
dbf6863
Compare
Aside: Should we put this code (and maybe others) to a |
@hansl based off of this reddit post, I'm not sure if people really like when libraries scatter an usage example into multiple files 😅 |
I understood this post for being "stop making examples thousands of lines long with implementations I might not need", not "stop abstracting reusable parts and using them in examples". In my ideal world, I'd rather have this: https://github.com/bytecodealliance/wasmtime/blob/main/examples/gcd.rs than having to implement a job queue just for an example, which becomes bloated (multiple files, hundreds of lines, etc). If anything this PR adds exactly what the Reddit post was expressing as frustration. Reusable pieces should be moved to the engine or a separate crate, and used in examples to show how simple adding Boa to your project is. Which is really what we want people to take away; add Boa, get JS running in 20 lines of code! Easy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The discussion above is not blocking to the code going in.
@hansl Ahh, I interpreted your comment as abstracting the job queue implementation for only the examples. I suppose you mean maintaining a crate of job queues for ease of use? I can see the utility in that. I would even put the implementations on |
I wouldn't use that in the futures examples though, because people still would want to know how to implement their own event loop. We can add a separate example on how to use the runtime. |
Correct.
I would reply that they can always read the code and doc (assuming it's well written, of course). |
I don't like assuming people will read the code base for questions they have, because most of the time they (unfortunately) don't 😅. Most users would open the examples folder, see that the "event_loop" example doesn't have an event loop, and either close the page or ask a question on how to do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
The examples look good. Was there any thought about putting together a blog post around the examples at some point to publish on the site. Could be a good post.
Gonna put it on draft for a moment to add an example on how to use |
Should be good to review now. |
Fixes #3531.
I'm surprised
tokio
uses so few dependencies, but I'm not complaining.