<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Actually this particular feature prevents you from doing anything reckless, like ignoring a method that would return a different instance of the self for example. By enforcing the default, anyone using the builder will effectively chain the calls and set the result only once OR write over the result over and over on consecutive lines as there is no was to know if you actually return the self or a new instance inside that builder. That pattern is effectively recommended when you pay attention to immutability/value types, where every single mutation the builder is exercising on 'self' could/should produce a different instance.</div> <br> <div id="bloop_sign_1477851151030071040" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Florent Vilmart<br></div></div> <br><p class="airmail_on">Le 30 octobre 2016 à 14:09:40, Robert Widmann via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) a écrit:</p> <blockquote type="cite" class="clean_bq"><span><div dir="auto"><div></div><div>



<title></title>


<div>If the methods return a reference to self it indicates that
you should probably just chain expressions together rather than
using a big wall of statements (Smalltalk encourages the same
pattern, funnily enough).</div>
<div id="AppleMailSignature"><br></div>
<div id="AppleMailSignature">As for the rest, yeah Swift is
opinionated. &nbsp;Every language is opinionated. &nbsp;We just
happen to care about being safe by default.<br>
<br>
~Robert Widmann</div>
<div><br>
2016/10/30 13:52、Jody Schofield &lt;<a href="mailto:jodyscho@gmail.com">jodyscho@gmail.com</a>&gt;
のメッセージ:<br>
<br></div>
<blockquote type="cite">
<div>

<div>I think assumptions are being made that shouldn't be. For
example I use a lot for design patterns such as the builder. Most
of the methods return a reference to self so they can be chained
together. The compiler shouldn't tell me I'm wrong for ignoring
those return values. It use to be my decision.<br>
<br></div>
<div id="AppleMailSignature">Swift was already a very opinionated
language and I can see it's being taken even further. A mistake in
my opinion and one that is certainly making the language more
frustrating than pleasurable to use.</div>
<div id="AppleMailSignature"><br></div>
<div id="AppleMailSignature"><br></div>
<div><br>
On Oct 30, 2016, at 1:32 PM, Robert Widmann &lt;<a href="mailto:devteam.codafi@gmail.com">devteam.codafi@gmail.com</a>&gt;
wrote:<br>
<br></div>
<blockquote type="cite">
<div>

<div>Functions that return values return them for a reason.
&nbsp;Ignoring them is, more likely than not, an oversight that
should be corrected, hence @discardableResult. &nbsp;We're talking
error codes, object lifetime tokens, failure indicators, etc.
&nbsp;All things that result in ignoring critical code paths for
the sake of convenience. &nbsp;If you find yourself executing a lot
of side effects and ignoring return values, I would take a look at
why. &nbsp;A lot of times you have control over the API and can
eliminate some of these unused return values. &nbsp;Otherwise,
please try to see if the return values of these functions are
relevant to the well-being of your program.</div>
<div id="AppleMailSignature"><br>
~Robert Widmann</div>
<div><br>
2016/10/30 8:49、Jody Schofield via swift-dev &lt;<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>&gt;
のメッセージ:<br>
<br></div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div style="font-size:13px">Sorry, I'm sure this has been discussed
before, but what the heck???</div>
<div style="font-size:13px"><br></div>
<div style="font-size:13px">This feature is killing me. Now I have
go add @discardableResult to every function that returns a non-Void
or use the ugly syntax `_ =`?&nbsp;</div>
<div style="font-size:13px"><br></div>
<div style="font-size:13px">Until swift 3 I've really enjoyed the
new language. Now I find it to be getting too rigid for the sake of
"protecting" me from myself. The safety levels needs to be dialled
back some.</div>
<div style="font-size:13px"><br></div>
<div style="font-size:13px"><br></div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div>
<span>_______________________________________________</span><br>
<span>swift-dev mailing list</span><br>
<span><a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a></span><br>
<span><a href="https://lists.swift.org/mailman/listinfo/swift-dev">https://lists.swift.org/mailman/listinfo/swift-dev</a></span><br>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>


_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></body></html>