Skip to content

Commit 2b00420

Browse files
committed
Mention Scala's Either type
1 parent f9451c3 commit 2b00420

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
@@ -290,9 +290,11 @@ However, it is often useful to briefly consider these variant types alone, which
290290
RFC proposes.
291291

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

297299
# Unresolved questions
298300
[unresolved-questions]: #unresolved-questions

0 commit comments

Comments
 (0)