Skip to content

Commit da309e1

Browse files
Fix remaining review suggestions
1 parent 63e728d commit da309e1

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

pages/docs/manual/v12.0.0/migrate-to-v12.mdx

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ If you encounter any missing information or issues during migration, please [ope
1515
- ReScript V11 project.
1616
- Uncurried mode must be enabled (i.e. you have not opted-out from it)
1717
- Your project must not contain any OCaml source code anymore, as support for `.ml` files is removed in this version. However there are ways to convert OCaml syntax with an older ReScript compiler version ([see below](#converting-generated-ml-files)).
18-
- The old configuration filename that was deprecated in v11, `bsconfig.json`, is removed. Rename it to `rescript.json`.
1918
- Minimum supported Node.js version is 20.11.0
2019

2120
### Standard Library Changes
@@ -56,14 +55,14 @@ this is replaced by `@rescript/runtime`, which is a installed as a dependency of
5655

5756
Some typical name changes include:
5857

59-
`Error.t` -> `JsError.t`
60-
`raise(MyException("error"))` -> `throw(MyException("error"))`
61-
`Js.Exn.Error` exception -> `JsExn`
62-
`Error.make` -> `JsExn.make`
63-
`Error.raise` -> `JsExn.raise`
64-
`Error.message` -> `JsExn.message`
65-
`Bool.fromStringExn("true")` -> `Bool.fromStringOrThrow("true")`
66-
`Int.Bitwise.lsl` -> `Int.shiftLeft`
58+
- `Error.t` -> `JsError.t`
59+
- `raise(MyException("error"))` -> `throw(MyException("error"))`
60+
- `Js.Exn.Error` exception -> `JsExn`
61+
- `Error.make` -> `JsExn.make`
62+
- `Error.raise` -> `JsExn.raise`
63+
- `Error.message` -> `JsExn.message`
64+
- `Bool.fromStringExn("true")` -> `Bool.fromStringOrThrow("true")`
65+
- `Int.Bitwise.lsl` -> `Int.shiftLeft`
6766

6867
Tip: You can use the migration tool to automatically replace these with the new functions.
6968

@@ -79,19 +78,37 @@ rescript-tools migrate <file> [--stdout]
7978
v11:
8079

8180
```res
82-
let x = ~a // bitwise NOT
83-
let y = a ^ b // bitwise XOR
84-
let z = a & b // bitwise AND
85-
let w = a | b // bitwise OR
81+
let w = lnot(a) // bitwise NOT
82+
let x = lxor(a, b) // bitwise XOR
83+
let y = land(a, b) // bitwise AND
84+
let z = lor(a, b) // bitwise OR
8685
```
8786

8887
v12:
8988

9089
```res
91-
let x = ~~~a // bitwise NOT
92-
let y = a ^^^ b // bitwise XOR
93-
let z = a &&& b // bitwise AND
94-
let w = a ||| b // bitwise OR
90+
let w = ~~~a // bitwise NOT
91+
let x = a ^^^ b // bitwise XOR
92+
let y = a &&& b // bitwise AND
93+
let z = a ||| b // bitwise OR
94+
```
95+
96+
### Shift operations
97+
98+
v11:
99+
100+
```res
101+
let x = lsl(a, b) // logical left shift
102+
let y = lsr(a, b) // logical right shift
103+
let z = asr(a, b) // unsigned right shift
104+
```
105+
106+
v12:
107+
108+
```res
109+
let x = a << b // logical left shift
110+
let y = a >> b // logical right shift
111+
let z = a >>> b // unsigned right shift
95112
```
96113

97114
### JSX children spread
@@ -191,7 +208,9 @@ rescript format
191208

192209
## Converting generated `.ml` files
193210

194-
Some projects still rely on tools such as `atdgen` that emit OCaml `.ml` files. ReScript 12 cannot compile those files directly, so you must keep using ReScript 11 **only** to convert the generated `.ml` files back to `.res` files before you run the v12 build.
211+
**Note**: This setup is an escape hatch. It keeps legacy generators like `atdgen` working but it also forces you to maintain two compiler versions. Whenever possible migrate such things to modern ReScript tooling such as [Sury](https://github.com/DZakh/sury/).
212+
213+
Some projects still rely on tools such as `atdgen` that emit `.ml` files. ReScript 12 cannot compile those files directly, so you must keep using ReScript 11 **only** to convert the generated `.ml` files back to `.res` files before you run the v12 build.
195214

196215
1. Keep ReScript 12 as the sole compiler dependency in your main project (i.e. `devDependencies.rescript` stays at `^12.0.0`).
197216

@@ -215,8 +234,6 @@ Some projects still rely on tools such as `atdgen` that emit OCaml `.ml` files.
215234
npm run convert-ml
216235
```
217236

218-
This setup is an escape hatch. It keeps legacy generators like `atdgen` working but it also forces you to maintain two compiler versions. Whenever possible migrate such things to modern ReScript tooling such as [Sury](https://github.com/DZakh/sury/).
219-
220237
## List of all breaking changes
221238

222239
Below is a consolidated excerpt of all the breaking changes from the compiler changelog.
@@ -252,11 +269,9 @@ Below is a consolidated excerpt of all the breaking changes from the compiler ch
252269

253270
### Build system & CLI
254271

255-
- The new Rust-based `rewatch` build system now powers the `rescript` command. The old Ninja-based builder system moved behind `rescript legacy`, and `--compiler-args` became the `compiler-args` subcommand. https://github.com/rescript-lang/rescript/pull/7551 https://github.com/rescript-lang/rescript/pull/7593
256-
- The `rescript legacy` subcommand was removed in favor of a stand-alone `rescript-legacy` binary. https://github.com/rescript-lang/rescript/pull/7928
272+
- The new Rust-based `rewatch` build system now powers the `rescript` command. The old Ninja-based builder system moved behind `rescript legacy`, and `--compiler-args` became the `compiler-args` subcommand. https://github.com/rescript-lang/rescript/pull/7551 https://github.com/rescript-lang/rescript/pull/7593 https://github.com/rescript-lang/rescript/pull/7928
257273
- `rescript format` was reimplemented in Rust, its options now use the `--check` / `--stdin` long-form spelling, and the `--all` flag was removed because every tracked file (non-dev by default) is formatted automatically. https://github.com/rescript-lang/rescript/pull/7603 https://github.com/rescript-lang/rescript/pull/7752
258274
- The `rescript dump` command was removed; call `bsc` directly if you need to inspect `.cmi` files. https://github.com/rescript-lang/rescript/pull/7710
259-
- `rewatch` now builds packages marked with `"type": "dev"` (and their `dev-dependencies`) by default, and the CLI `--dev` flag no longer has any effect. https://github.com/rescript-lang/rescript/pull/7934
260275

261276
### Configuration & platform
262277

0 commit comments

Comments
 (0)