Skip to content

Commit f6b2000

Browse files
committed
Small wording tweaks
1 parent 2dd6b31 commit f6b2000

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

_blogposts/2021-02-09-release-9-0.mdx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ category: compiler
66
title: ReScript 9.0
77
badge: release
88
description: |
9+
Featuring a new external stdlib configuration, some syntax improvements and a small breaking change for nested records.
910
---
1011

1112
## Introduction
1213

1314
We are happy to announce ReScript 9.0!
1415

15-
ReScript is a strongly typed language that compiles to efficient, fully-typed and human-readable JavaScript. It comes with one of the fastest JS compiler toolchains available today and offers first class support for ReactJS development.
16+
ReScript is a robustly typed language that compiles to efficient and human-readable JavaScript. It comes with one of the fastest build toolchains and offers first class support for interoperating with ReactJS and other existing JavaScript code.
1617

1718
Use `npm` to install the newest [9.0.0 release](https://www.npmjs.com/package/bs-platform/v/9.0.0) with the following command:
1819

@@ -48,7 +49,7 @@ With this configuration set, compiled JS code will now point to the defined `ext
4849
<CodeTab labels={["ReScript", "JavaScript"]}>
4950

5051
```res
51-
Belt.Array.forEach([1,2,3], (num) => Js.log(num))
52+
Belt.Array.forEach([1, 2, 3], (num) => Js.log(num))
5253
```
5354

5455
```js
@@ -100,7 +101,7 @@ let test = x =>
100101
}
101102
```
102103

103-
Now let's have a look at how the JS output would look like in comparison to older versions:
104+
The snippet above will compile to the following JS output:
104105

105106
<CodeTab labels={["9.0 Output", "8.4 Output" ]}>
106107

@@ -151,6 +152,8 @@ function is_space(param){
151152

152153
Starting from 9.0, [`when` clauses](/docs/manual/latest/pattern-matching-destructuring#when-clause) within a `switch` statement will automatically convert to the `if` keyword instead.
153154

155+
<CodeTab labels={["New (9.0)", "Old (8.4)"]}>
156+
154157
```res
155158
switch person1 {
156159
| Student({reportCard: {gpa}}) if gpa < 0.5 =>
@@ -159,8 +162,17 @@ switch person1 {
159162
}
160163
```
161164

162-
The syntax parser and printer will automatically take care of older code, so no action required for existing codebases. The `when` keyword is deprecated.
165+
```res
166+
switch person1 {
167+
| Student({reportCard: {gpa}}) when gpa < 0.5 =>
168+
Js.log("What's happening")
169+
| _ => () // do nothing
170+
}
171+
```
163172

173+
</CodeTab>
174+
175+
The `when` keyword is deprecated. The syntax will continue supporting it and the formatter will automatically convert to `if`, for a pain-free upgrade.
164176

165177
### Cleaner Polyvariant Syntax
166178

@@ -228,7 +240,6 @@ let age = data["user"]["age"]
228240

229241
More discussions on this change can be found [here](https://forum.rescript-lang.org/t/fixing-the-semantics-of-nested-objects-breaking-changes/976).
230242

231-
232243
## Closing Note
233244

234245
We only highlighted a few user-facing features, but there are also some pretty interesting internal changes happening right now.

0 commit comments

Comments
 (0)