Skip to content

Commit da91d30

Browse files
committed
clarify some sentences
1 parent ad51c7a commit da91d30

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

blog/boa-release-21/index.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub type FutureJob = Pin<Box<dyn Future<Output = NativeJob> + 'static>>;
7676

7777
With this definition, it was pretty much impossible to capture the `Context`
7878
inside the `Future`, and functions that needed to interweave engine operations
79-
with awaiting `Future`s would have to be split into multiple parts:
79+
with awaiting `Future`s needed to be split into multiple parts:
8080

8181
```rust
8282
let fetch = async move {
@@ -143,7 +143,7 @@ a `Future`.
143143

144144
After introducing the new job type, changes had to be made on
145145
[`JobQueue`](https://docs.rs/boa_engine/0.20.0/boa_engine/job/trait.JobQueue.html)
146-
to better support new job types. Thus, `JobQueue` was revamped and renamed to be the
146+
to better support new types of jobs. Thus, `JobQueue` was revamped and renamed to be the
147147
new `JobExecutor`:
148148

149149
```rust
@@ -283,18 +283,22 @@ finish_load: Box<dyn FnOnce(JsResult<Module>, &mut Context)>,
283283
```
284284

285285
Unfortunately,
286-
this API has downsides: it is still possible to forget to call `finish_load`,
287-
which is still safe but prone to bugs. It is also really painful to work with,
288-
because you cannot capture the `Context` to further process the module after
289-
loading it ... Sounds familiar? **This is exactly [the code snippet we talked about before!](#async-apis-enhancements)**
286+
this API has downsides: it is possible to forget to call `finish_load`,
287+
which is safer than a dangling `*const()` pointer, but still prone to bugs.
288+
It is also really painful to work with, because you cannot capture the `Context`
289+
to further process the module after loading it ... Sounds familiar?
290+
**[The async code snippet we showed before](#async-apis-enhancements) has this exact problem!**
291+
And that snippet is directly taken from [one of our `ModuleLoader` implementation examples][mod-loader].
292+
293+
[mod-loader]: https://github.com/boa-dev/boa/blob/b345775138f56401bd627b1f36daadfc5bf75772/examples/src/bin/module_fetch.rs#L38
290294

291295
Fast forward a couple of years and we're now changing big parts of `JobExecutor`:
292296
adding new job types, tinkering with `JobExecutor`, changing API signatures, etc.
293297
Then, while looking at the definition of `ModuleLoader`, we thought...
294298

295299
> Huh, can't we make `load_imported_module` async now?
296300
297-
And that's exactly what we did! Behold, the new `ModuleLoader`!
301+
And that's exactly what we did. Behold, the new `ModuleLoader`!
298302

299303
```rust
300304
pub trait ModuleLoader: Any {

0 commit comments

Comments
 (0)