Skip to content

Commit 14a6e83

Browse files
authored
Mention Scala's Either type
1 parent 508b43b commit 14a6e83

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

text/0000-enum-variant-types.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,11 @@ However, it is often useful to briefly consider these variant types alone, which
277277
RFC proposes.
278278

279279
Although sum types are becoming increasingly common in programming languages, most do not choose to
280-
allow the variants to be treated as types in their own right (that is, the author has not found
281-
any that permit this design pattern). However, we propose that the patterns in Rust make variant
282-
types more appealing than they might be in other programming languages with variant types.
280+
allow the variants to be treated as types in their own right. There are some languages that have
281+
analogues however: Scala's [`Either` type](https://www.scala-lang.org/api/2.9.3/scala/Either.html)
282+
has `Left` and `Right` subclasses that may be treated as standalone types, for instance. Regardless
283+
of the scarcity of variant types however, we propose that the patterns in Rust make variant types
284+
more appealing than they might be in other programming languages with variant types.
283285

284286
# Unresolved questions
285287
[unresolved-questions]: #unresolved-questions

0 commit comments

Comments
 (0)