Closed
Description
Recent ox releases include a boundary-break implementation specialised to Either
s, which allows you to write "unwrap" an Either
within a specified boundary, for example:
def lookupUser(id1: Int): Either[String, User] = ???
def lookupOrganization(id2: Int): Either[String, Organization] = ???
val result: Either[String, Assignment] = either:
val user = lookupUser(1).value
val org = lookupOrganization(2).value
Assignment(user, org)
Here, .value
is used for the "unwrapping". However, one alternative would be to use the Rust-inspired .?
. On the one hand, @lbialy argues that .value
is clash-prone, along with @Ichoran who says .value
suggests that it's a safe accessor.
On the other, symbolic operators historically didn't work out that well, plus, as @alexandru points out, it looks awkward and doesn't play well with fewer-braces.
What's your take? Vote with a 👍 on a comment with your pick, or propose your own!
Metadata
Metadata
Assignees
Labels
No labels