You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/manual/latest/polymorphic-variant.mdx
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Now that we know what [variant types](./variant) are, let's dive into a more spe
10
10
11
11
First off, here are some key features:
12
12
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).
14
14
- 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.
15
15
- Due to their structural nature, poly variant types may cause tricky type checking errors when types don't match up.
16
16
@@ -81,7 +81,7 @@ var admin = "admin";
81
81
82
82
</CodeTab>
83
83
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:
85
85
86
86
<CodeTablabels={["ReScript", "JS Output"]}>
87
87
@@ -98,9 +98,11 @@ var oneA = "1a";
98
98
99
99
</CodeTab>
100
100
101
+
**Note:** The `\` character will be dropped in future syntax versions (way cleaner look, e.g. `#"1"`).
102
+
101
103
### Constructor Arguments
102
104
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:
0 commit comments