Skip to content

Commit 8074aa5

Browse files
committed
Improvements from @zth
1 parent 1c8fb84 commit 8074aa5

File tree

1 file changed

+61
-13
lines changed

1 file changed

+61
-13
lines changed

_blogposts/2022-08-24-release-10-0-0.mdx

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,80 @@ description: |
88
The first community powered release.
99
---
1010

11-
** Introduction **
11+
ReScript version 10 is available! Version 10 is a culmination of over a year's worth of work, bringing faster builds, improving JS interop, and a including a bunch of bug fixes. It's also the first fully community powered release, with contributions from over 20 community members.
1212

13-
ReScript is a soundly typed language with an optimizing compiler focused on the JS platform.
14-
It's focused on type safety, performance and JS interop.
13+
All changes are listed [here](https://github.com/rescript-lang/rescript-compiler/blob/10.0_release/CHANGELOG.md). Let's take a tour of a few of the features we're extra excited about.
1514

16-
[ReScript@10.0](https://www.npmjs.com/package/rescript/v/10.0.0) is now available for testing, you can try it via
15+
## Faster builds with native M1 support
16+
Users with M1 chips should see a notable speedup, as the new ReScript version has full native support for M1.
1717

18+
## Better ergonomics with unicode support in regular strings
19+
You can now use unicode characters directly in regular strings. This will now produce what you'd expect:
20+
```res
21+
let str = "Σ"
1822
```
19-
npm i rescript@10.0.0
23+
24+
You can also pattern match on unicode characters:
25+
```res
26+
switch someCharacter {
27+
| 'Σ' => "what a fine unicode char"
28+
| _ => "unicode is fun"
29+
}
2030
```
2131

22-
The detailed changes are listed [here](https://github.com/rescript-lang/rescript-compiler/blob/10.0_release/CHANGELOG.md).
32+
## Experimental optional record fields
33+
Previously, a record would always have to define all its optional fields:
34+
```res
35+
type user = {
36+
name: string,
37+
age: option<int>
38+
}
39+
40+
let userWithoutAge = {
41+
name: "Some Name",
42+
age: None,
43+
}
44+
45+
let userWithAge = {
46+
name: "Some Name",
47+
age: Some(34),
48+
}
49+
```
50+
For small records like the one above, this is typically fine. But for records with many fields, the friction of having to always set all optional fields explicitly adds up. This release has a new experimental feature called optional record fields, allowing you to rewrite the above to this instead:
2351

24-
** Upgrade guide **
52+
```res
53+
type user = {
54+
name: string,
55+
age?: int
56+
}
57+
58+
// No need to set `age` unless it should have a value
59+
let userWithoutAge = {
60+
name: "Some Name",
61+
}
62+
63+
let userWithAge = {
64+
name: "Some Name",
65+
age: 34
66+
}
67+
```
68+
69+
Other than drastically improving the experience when working with large records with optional fields, this also has implications for bindings. For example, binding to JS API:s with large configuration objects is now more ergonomic.
70+
This feature also paves the way for other exciting features coming in the next release.
71+
72+
## What's next
73+
74+
Version 10 brings the building blocks needed for a number of exciting new features that'll be available in the version after this. Features ranging from native support for async/await, to a new version of the JSX integration, making it leaner and more flexible. You'll hear more about this soon.
75+
76+
## Upgrade guide
2577

2678
Please see the detailed [changelog](https://github.com/rescript-lang/rescript-compiler/blob/10.0_release/CHANGELOG.md) for a list of breaking changes.
2779
Each breaking change lists suggestions on how to upgrade your project.
2880
This can be out of your control in case of dependencies. In that case, please raise issues with the maintainers of those libraries.
2981

3082
One special word for PPXs, in particular for PPX authors. As mentioned in the changelog, some PPXs may give an error `"Attributes not allowed here"`. The solution is to adapt the PPXs following the example of `rescript-relay` in https://github.com/zth/rescript-relay/pull/372.
3183

32-
** What's next **
33-
34-
The 10.0 release contains the changes (including breaking) and bug fixes to the compiler from the last year or so. This will be followed by release 10.1 which will contain the new features enabled by this, ranging from native support for async/await, to the new V4 version of JSX.
35-
36-
** Acknowledgements **
84+
## Acknowledgements
3785

38-
This is the first community powered release. We would like to thank everyone from the community who volunteered their precious time to suport this project with contributions of any kind, from documentation, to PRs, to discussions in the forum.
86+
We would like to thank everyone from the community who volunteered their precious time to suport this project with contributions of any kind, from documentation, to PRs, to discussions in the forum.
3987
In particular, thank you @cknitt, @TheSpyder, @mattdamon108, @DZakh, @fhammerschmidt, @amiralies, @Minnozz, @Zeta611, @jchavarri, @nkrkv, @whitchapman, @ostera, @benadamstyles, @cannorin, @ClaireNeveu, @kevinbarabash, @JsonKim, @Sehun0819, @glennsl, @namenu, @a-c-sreedhar-reddy.

0 commit comments

Comments
 (0)