Skip to content

Commit

Permalink
Mention Scala's Either type
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor authored Nov 10, 2018
1 parent 508b43b commit 14a6e83
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions text/0000-enum-variant-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ However, it is often useful to briefly consider these variant types alone, which
RFC proposes.

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

# Unresolved questions
[unresolved-questions]: #unresolved-questions
Expand Down

0 comments on commit 14a6e83

Please sign in to comment.