You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2024-07-09-boa-release-19.md
+59-3Lines changed: 59 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,10 @@ release of the Boa JavaScript engine. Boa makes it easy to embed a JS engine in
12
12
you can even use it from WebAssembly. See the [about](/about) page for more info.
13
13
14
14
In this release, our conformance has grown from 85.03% to 87.3% in the official ECMAScript Test Suite
15
-
(Test262). Interestingly, not all of this is due to us passing more tests, but in fact the total number of tests from test262
16
-
[reducing by around 2000](https://github.com/tc39/test262/commit/ea2268aa4382013f5533b91f9ef50366ad065a86) from the [removal of custom calendars and timezones](https://github.com/tc39/proposal-temporal/issues/2826). Overall, Boa's conformance in real terms has improved by ~6%.
15
+
(Test262). Interestingly, this was partly because around 2000 tests
16
+
were [removed from test262](https://github.com/tc39/test262/commit/ea2268aa4382013f5533b91f9ef50366ad065a86)
17
+
as part of the [removal of custom calendars and timezones](https://github.com/tc39/proposal-temporal/issues/2826).
18
+
Overall, Boa's conformance in real terms has improved by ~6%.
17
19
18
20
You can check the full list of changes [here][changelog], and the full information on conformance
19
21
[here][conformance].
@@ -108,9 +110,63 @@ Thank you to the new contributors to Boa for this release, you can find their co
108
110
109
111
## Looking Forward
110
112
113
+
Before finishing this blog post, we wanted to give a special shoutout to @hansl, one of our new
114
+
contributors for this release! He's been working on improving the ergonomics around exposing
115
+
Rust functions and types as ECMAScript functions and classes with a lot of nice API enhancements.
116
+
Some notable PRs are:
117
+
118
+
-[Add a boa_interop crate](https://github.com/boa-dev/boa/pull/3772)
119
+
-[Add a new type Convert<> to convert values](https://github.com/boa-dev/boa/pull/3786)
120
+
-[Add a ContextData struct to inject host defined types from the context](https://github.com/boa-dev/boa/pull/3802)
121
+
-[Add a js_class to implement the Class trait without boilerplate](https://github.com/boa-dev/boa/pull/3872)
122
+
123
+
Unfortunately, the aforementioned `boa_interop` crate was not published for this version, and that's
124
+
because we would like to polish it first and integrate it within the other crates of the project.
125
+
However, we can give you a sneak peek of what some of the new APIs will allow you to do. Hopefully
126
+
this will make you look forward for v0.20!
127
+
128
+
```
129
+
use boa_interop::{js_class, Ignore, JsClass};
130
+
131
+
#[derive(Clone, Trace, Finalize, JsData)]
132
+
pub enum Animal {
133
+
Cat,
134
+
Dog,
135
+
Other,
136
+
}
137
+
138
+
js_class! {
139
+
// Implements the [`Class`] trait for the `Animal` enum.
140
+
class Animal {
141
+
// This sets a field on the JavaScript object. The arguments to
142
+
// `init` are the arguments passed to the constructor.
143
+
public age(_name: Ignore, age: i32) -> i32 {
144
+
age
145
+
}
146
+
// This is called when a new instance of the class is created in
147
+
// JavaScript, e.g. `new Animal("cat")`.
148
+
constructor(name: String) {
149
+
match name.as_str() {
150
+
"cat" => Ok(Animal::Cat),
151
+
"dog" => Ok(Animal::Dog),
152
+
_ => Ok(Animal::Other),
153
+
}
154
+
}
155
+
// Declare a function on the class itself.
156
+
fn speak(this: JsClass<Animal>) -> JsString {
157
+
match *this.borrow() {
158
+
Animal::Cat => js_string!("meow"),
159
+
Animal::Dog => js_string!("woof"),
160
+
Animal::Other => js_string!(r"¯\_(ツ)_/¯"),
161
+
}
162
+
}
163
+
}
164
+
}
165
+
```
166
+
111
167
### How can you support Boa?
112
168
113
-
Boa is an independent JavaScript engine implementing the ECMAScript specification, we rely on the
169
+
Boa is an independent JavaScript engine implementing the ECMAScript specification, and we rely on the
114
170
support of the community to keep it going. If you want to support us, you can do so by donating to
115
171
our [open collective]. Proceeeds here go towards this very website, the domain name, and remunerating
116
172
members of the team who have worked on the features released.
0 commit comments