Skip to content

Commit eced089

Browse files
Merge pull request #757 from tsnobip/remove_unboxed
remove unboxed doc, point it to untagged variant
2 parents 69a705d + 1fabe8d commit eced089

File tree

3 files changed

+10
-162
lines changed

3 files changed

+10
-162
lines changed

misc_docs/syntax/decorator_unboxed.mdx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ category: "decorators"
77
---
88

99
The `@unboxed` decorator provides a way to unwrap **variant** constructors
10-
that have a *single* argument, or **record** objects that have a *single* field.
10+
that have no overlap in their runtime representation, or **record** objects that have a *single* field.
1111

1212
### Example
1313

1414
<CodeTab labels={["ReScript", "JS Output"]}>
1515

1616
```res
1717
@unboxed
18-
type name = Name(string)
18+
type listItemValue = String(string) | Boolean(bool) | Number(float)
19+
let myArray = [String("Hello"), Boolean(true), Boolean(false), Number(13.37)]
1920
let studentName = Name("Joe")
2021
2122
@unboxed
@@ -24,12 +25,16 @@ let hi = {message: "hello!"}
2425
```
2526

2627
```js
27-
var studentName = "Joe";
28+
var myArray = ["hello", true, false, 13.37];
2829
var hi = "hello!";
2930
```
3031

3132
</CodeTab>
3233

34+
_`@unboxed` for variants with multiple constructors is available since ReScript `11.0.0`._
35+
3336
### References
3437

35-
* [Unboxed](/docs/manual/latest/unboxed)
38+
* [Untagged variants doc](/docs/manual/latest/variant#untagged-variants)
39+
* [Blog post introducing untagged variants](/blog/improving-interop)
40+
* [Unboxed record](/docs/manual/v10.0.0/unboxed)

pages/docs/manual/latest/interop-cheatsheet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This is a glossary with examples. All the features are described by later pages.
4444
- [`@JSX`](jsx)
4545
- `@react.component`: [here](/docs/react/latest/introduction) and [here](https://github.com/reasonml/reason-react)
4646
- [`@warning`](attribute#usage)
47-
- [`@unboxed`](unboxed)
47+
- [`@unboxed`](variant#untagged-variants)
4848

4949
### Extension Points
5050

pages/docs/manual/latest/unboxed.mdx

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)