Skip to content

Commit 1a46129

Browse files
committed
fix confusion between the release plan and the future roadmap
1 parent 2267f97 commit 1a46129

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

_blogposts/2025-04-05-introducing-unified-operators.mdx

+6-12
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ And this won't be compiled
8484

8585
```res
8686
let compareNumber = (a: int, b: float) => a < b
87-
// ~~~
87+
// ~
8888
// [E] Line 1, column 46:
8989
// This has type: float
9090
// But it's being compared to something of type: int
@@ -172,15 +172,13 @@ In ReScript v12, most familiar JavaScript operators should work as-is — not ju
172172
- Bitwise operators (`~`, `^`, `|`, `&`) - [#7216](https://github.com/rescript-lang/rescript/pull/7216) (only XOR for now)
173173
- Shift operators (`<<`, `>>`, `>>>`) - [#7183](https://github.com/rescript-lang/rescript/pull/7183)
174174

175-
### Better comparison operators
175+
### The future of comparison operators
176176

177-
The comparison behavior described above has not changed.
178-
179-
The comparability of records and tuples is a very useful property when dealing with data structures. However, relying on the runtime type information is not an ideal solution.
177+
The comparison behavior described above has not changed. The comparability of records and tuples is useful when dealing with data structures. However, relying on the runtime type information is not an ideal solution.
180178

181179
Since record types are much broader than primitive types, we need a new approach beyond the unified operators.
182180

183-
The compiler fully understands the structure of each record type so it can generate optimized code. Imagine Rust's `#[derive(Eq)]` but for ReScript.
181+
This won't be included in the v12 release, but we'd like to share an idea we're exploring. Imagine Rust's `#[derive(Eq)]` but for ReScript. As the compiler fully understands the structure of each record type, it can generate optimized code for each type.
184182

185183
```res
186184
@deriving([compare, equals])
@@ -203,15 +201,11 @@ function person$equals(a, b) {
203201
}
204202
```
205203

206-
The compiler can perform the same specialization used in unified operators and generate code where the comparison operation is used. So `(a :> person) < b` is expected to be `person$compare(a, b) < 0` or fully inlined as it is less complex than a certain threshold.
204+
Then, the compiler performs the same specialization used in unified operators and generates code where the comparison operation is used. So `(a :> person) < b` is expected to be `person$compare(a, b) < 0` or fully inlined as it is less complex than a certain threshold.
207205

208206
The example is over-simplified, but it should work equally well with more complex, nested structures or sum types.
209207

210-
### Efficient React memoization
211-
212-
One possible use case for generated comparison operators is React apps.
213-
214-
Using complex types in production apps can result in significant performance degradation, as ReScript ADTs are not compatible with React's memoization behavior.
208+
One possible use case for generated comparison operators is React apps. Using complex types in production apps can result in significant performance degradation, as ReScript ADTs are not compatible with React's memoization behavior.
215209

216210
```res
217211
module MyComponent = {

0 commit comments

Comments
 (0)