<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I don’t agree that `Result` as a name is any more intuitive than `Either` (a disjointed union). &nbsp;The end result of any function is a `resulting` value regardless of what type it is. &nbsp;`Either` is just indicating that the function can return either of two types (generalized). &nbsp;So when you are returning either of two types (regardless of whether it is validation) - it would intuitively be driven by what type you are returning. &nbsp;I have never seen an Either used for the same type on both sides. &nbsp;As such I don’t find `Result` being intuitive vs `Either` being not a very strong argument. &nbsp;<div class=""><br class=""></div><div class="">`Either` is a type that is common to many functional languages, or functional implementations in more general languages.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2016-01-26, at 12:55:27, Kevin Ballard via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">


<title class=""></title>

<div class=""><div class="">There absolutely is a cost. `Result&lt;T&gt;` has a rather intuitive meaning. `Either&lt;T&gt;` has&nbsp;<i class="">no intuitive meaning whatsoever</i>. It says absolutely&nbsp;<i class="">nothing</i> about what it means beyond the fact that there are two potential values. As a result, it is a largely useless type whose sole redeeming feature is it allows developers to avoid having to define their own enum, but in most cases that aren't covered by Result&lt;T&gt; you actually&nbsp;<i class="">want</i> to define your own enum so you can attach meaning to the value.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">If it's not obvious, I'm very strongly against having a generic Either type, but I do want a Result&lt;T&gt; or Result&lt;T,E&gt;.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">-Kevin Ballard</div>
<div class="">&nbsp;</div>
<div class="">On Fri, Jan 22, 2016, at 10:22 PM, Developer via swift-evolution wrote:<br class=""></div>
<blockquote type="cite" class=""><div class=""><div class="">My overwhelming concern, after having a conversation with Chris, is that implementing a Result&lt;T&gt; means we are strongly implying a particular semantics and use case when we could generalize and abstract for no cost but an extra generic parameter. &nbsp;In F#, Core.Choice can be used to build a Validation or Result monad, but the converse is impossible.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">~Robert Widmann<br class=""></div>
</div>
<div class=""><div class="">&nbsp;</div>
<div class="">2016/01/23 1:05、Rob Mayoff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; のメッセージ:<br class=""></div>
</div>
<blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex;" class=""><div class="">Just added a section of motivating examples to the Either proposal.&nbsp; Ping me if you have any more that I missed ('cause I'm sure I did miss a lot).<br class=""></div>
<div class="">&nbsp;</div>
<div class=""> <a href="https://github.com/typelift/swift-evolution/blob/either-or/proposals/0024-either.md#motivating-examples" class="">https://github.com/typelift/swift-evolution/blob/either-or/proposals/0024-either.md#motivating-examples</a><br class=""></div>
<div class="">&nbsp;</div>
</blockquote><div class="">&nbsp;</div>
<div class="">Your motivating examples (including all the projects you linked except "Any many more") overwhelmingly use the Either (or similar type) to represent success/failure. I'm not sure there's a single example where the names Left and Right actually make sense in the problem domain. I'm not 100% sure about func alternate in Madness/Alternation.swift. It definitely uses Left/Right to mean Failure/Result, but I couldn't tell if it also uses them as something else. Which makes those names all the more maddening.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">I checked my company's largest Scala project, which is over 300,000 lines. We use Scala's Try/Success/Failure in dozens of places. We use Either/Left/Right once, in a thrown-together report-generating script, which would probably have been written in awk or perl if it didn't need to read binary log files. (The ability of IntelliJ to reliably find all uses of a class or method is not to be underestimated. Hint hint, team Xcode.)<br class=""></div>
<div class="">&nbsp;</div>
<div class="">I think a Result/Success/Failure type is warranted, but I'm very skeptical about generic Either/Left/Right.<br class=""></div>
<div class="">&nbsp;</div>
</div>
</div>
</div>
</div>
</blockquote><blockquote type="cite" class=""><div class=""><div class=""><span class="">_______________________________________________</span><br class=""></div>
<div class=""><span class="">swift-evolution mailing list</span><br class=""></div>
<div class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""></div>
<div class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div>
</div>
</blockquote><div class=""><u class="">_______________________________________________</u><br class=""></div>
<div class="">swift-evolution mailing list<br class=""></div>
<div class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""></div>
<div class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div>
</blockquote><div class="">&nbsp;</div>
</div>

_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>