Skip to content

Commit

Permalink
Merge pull request #757 from tsnobip/remove_unboxed
Browse files Browse the repository at this point in the history
remove unboxed doc, point it to untagged variant
  • Loading branch information
fhammerschmidt authored Dec 5, 2023
2 parents 69a705d + 1fabe8d commit eced089
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 162 deletions.
13 changes: 9 additions & 4 deletions misc_docs/syntax/decorator_unboxed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ category: "decorators"
---

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

### Example

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

```res
@unboxed
type name = Name(string)
type listItemValue = String(string) | Boolean(bool) | Number(float)
let myArray = [String("Hello"), Boolean(true), Boolean(false), Number(13.37)]
let studentName = Name("Joe")
@unboxed
Expand All @@ -24,12 +25,16 @@ let hi = {message: "hello!"}
```

```js
var studentName = "Joe";
var myArray = ["hello", true, false, 13.37];
var hi = "hello!";
```

</CodeTab>

_`@unboxed` for variants with multiple constructors is available since ReScript `11.0.0`._

### References

* [Unboxed](/docs/manual/latest/unboxed)
* [Untagged variants doc](/docs/manual/latest/variant#untagged-variants)
* [Blog post introducing untagged variants](/blog/improving-interop)
* [Unboxed record](/docs/manual/v10.0.0/unboxed)
2 changes: 1 addition & 1 deletion pages/docs/manual/latest/interop-cheatsheet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This is a glossary with examples. All the features are described by later pages.
- [`@JSX`](jsx)
- `@react.component`: [here](/docs/react/latest/introduction) and [here](https://github.com/reasonml/reason-react)
- [`@warning`](attribute#usage)
- [`@unboxed`](unboxed)
- [`@unboxed`](variant#untagged-variants)

### Extension Points

Expand Down
157 changes: 0 additions & 157 deletions pages/docs/manual/latest/unboxed.mdx

This file was deleted.

0 comments on commit eced089

Please sign in to comment.