Skip to content

Commit 08ac6ad

Browse files
committed
Add note on escaped poly var syntax
1 parent 90576dc commit 08ac6ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pages/docs/manual/latest/polymorphic-variant.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Now that we know what [variant types](./variant) are, let's dive into a more spe
1010

1111
First off, here are some key features:
1212

13-
- Poly variants are structurally typed, which means they don't require any explicit type definition to be used as a value, and are not coupled to any specific module. The compiler will infer the type on demand, and compare poly variants by their value, instead of their type name (which is called nominal typing).
13+
- Poly variants are structurally typed, which means they don't require any explicit type definition to be used as a value, and are not coupled to any specific module. The compiler will infer the type on demand, and compare poly variants by their value, instead of their type name (which would be called nominal typing).
1414
- They allow easier JavaScript interop (compile to strings / objects with predictable `NAME` and `VAL` attribute) and don't need explicit runtime conversions, unlike common variants.
1515
- Due to their structural nature, poly variant types may cause tricky type checking errors when types don't match up.
1616

@@ -81,7 +81,7 @@ var admin = "admin";
8181

8282
</CodeTab>
8383

84-
In rare cases (mostly for JS interop reasons), it's also possible to define invalid identifiers, such as hypens or numbers:
84+
In rare cases (mostly for JS interop reasons), it's also possible to define "invalid identifiers", such as hypens or numbers:
8585

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

@@ -98,9 +98,11 @@ var oneA = "1a";
9898

9999
</CodeTab>
100100

101+
**Note:** The `\` character will be dropped in future syntax versions (way cleaner look, e.g. `#"1"`).
102+
101103
### Constructor Arguments
102104

103-
This is equivalent to what we've already learned with common variants:
105+
This is equivalent to what we've [already learned](variant#constructor-arguments) with common variants:
104106

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

0 commit comments

Comments
 (0)