<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=""><div class="">Paul, let’s start a new thread about this — I was going to write about the same idiom, but it’s out of scope of this review.</div><div class=""><br class=""></div><div class="">I disagree with Dave that this is just a EDSL, I think things like completion/success/failure handlers are a very common pattern, and it would be great to have consistent naming and a Guidelines recommendation for them. (Usually in the context of argument names, not chainable methods, which are, indeed, quite DSL-y).</div><br class=""><div class="">
<div class="">— Radek</div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 25 Jan 2016, at 04:48, Paul Cantrell via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">Siesta uses the widespread fluent style of attaching callbacks to a request:</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo; color: rgb(88, 126, 168);"> resource<span class="" style="">.</span>load<span class="" style="">()</span></div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> .onCompletion {<span class="Apple-converted-space"> </span><span class="" style="color: rgb(50, 62, 125);">_</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(50, 62, 125);">in</span><span class="Apple-converted-space"> </span>stopSpinnyThing() }</div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> <span class="" style="font-size: 10.5px;">.onSuccess {<span class="Apple-converted-space"> </span></span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">_</span><span class="" style="font-size: 10.5px;"><span class="Apple-converted-space"> </span></span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">in</span><span class="" style="font-size: 10.5px;"><span class="Apple-converted-space"> </span>showHappyFace() }</span></div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> .onFailure {<span class="Apple-converted-space"> </span><span class="" style="color: rgb(50, 62, 125);">_</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(50, 62, 125);">in</span><span class="Apple-converted-space"> </span>showSadFace() }</div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> <span class="" style="font-size: 10.5px;">.onNewData {<span class="Apple-converted-space"> </span></span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">_</span><span class="" style="font-size: 10.5px;"><span class="Apple-converted-space"> </span></span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">in</span><span class="" style="font-size: 10.5px;"><span class="Apple-converted-space"> </span>soundTrumpets() }</span></div></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">These methods mutate the receiving request (by adding a callback), and the guidelines thus say that they should be named as imperative verbs. The results of that don’t seem like an improvement:</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo; color: rgb(88, 126, 168);"> resource<span class="" style="">.</span>load<span class="" style="">()</span></div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> .addCompletionCallback { <span class="" style="color: rgb(50, 62, 125);">_</span> <span class="" style="color: rgb(50, 62, 125);">in</span> stopSpinnyThing() }</div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> <span class="" style="font-size: 10.5px;">.addSuccessCallback { </span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">_</span><span class="" style="font-size: 10.5px;"> </span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">in</span><span class="" style="font-size: 10.5px;"> showHappyFace() }</span></div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> .addFailureCallback { <span class="" style="color: rgb(50, 62, 125);">_</span> <span class="" style="color: rgb(50, 62, 125);">in</span> showSadFace() }</div><div class="" style="margin: 0px; font-size: 10.5px; line-height: normal; font-family: Menlo;"> <span class="" style="font-size: 10.5px;">.addNewDataCallback { </span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">_</span><span class="" style="font-size: 10.5px;"> </span><span class="" style="font-size: 10.5px; color: rgb(50, 62, 125);">in</span><span class="" style="font-size: 10.5px;"> soundTrumpets() }</span></div></div></div><br class="Apple-interchange-newline"></div></blockquote></div><br class=""></body></html>