<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><br class=""><blockquote type="cite" class=""><div class=""><span 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; float: none; display: inline !important;" class="">method cascades</span></div></blockquote></div>I thought there was some sort of showstopper that ended further discussion for Swift 3 — but seems it wasn't the fault of the archive that I didn't find that reason ;-)<div class=""><br class=""></div><div class="">I'll use the opportunity to talk about my major motivation to want cascades in Swift:</div><div class="">Several years ago, I was quite bored by Objective-C and did an inquiry what other languages I might like.</div><div class="">I considered exotic choices like Vala (reference counted, compiled), but despite my dislike for garbage-collected systems, I also looked at the JVM.</div><div class="">At that time, my feeling was that many people were deeply impressed by some goodies Groovy had to offer, but didn't want to give up the benefits of type safety.</div><div class="">One of the major selling point for a nice contender called "Kotlin" has been "type safe, Groovy-style builders", and their use case might become very important for Swift as well.</div><div class=""><br class=""></div><div class="">I'll just show an example:</div><div class=""><div class="">let page = HTML().{</div><div class="">&nbsp; body.{</div><div class="">&nbsp; &nbsp; table.{</div><div class="">&nbsp; &nbsp; &nbsp; tr.{</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; td.text("Cell content")</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; td.text("Another cell")</div><div class="">&nbsp; &nbsp; &nbsp; }</div><div class="">&nbsp; &nbsp; }</div><div class="">&nbsp; &nbsp; div(color: .redColor()).text("Some text")</div><div class="">&nbsp; }</div><div class="">}</div></div><div class=""><br class=""></div><div class="">// basic principle: directly start a method cascade on computed properties</div><div class=""><br class=""></div><div class="">This piece of code (I'm not using the proposed "with"-syntax but a light-weight alternative that I'd prefer) could generate a complete HTML-page, ready to be send to a browser — and the syntax is much easier than the generated markup itself!</div><div class=""><br class=""></div><div class="">With Swift on Linux, I'm quite sure generating HTML will become a very important task for the language.</div><div class=""><br class=""></div><div class="">Tino</div></body></html>