<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ah I see you point a bit better.<div class=""><br class=""></div><div class="">But I don't agree with your example, since it can be easily expressed with</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">test</span><span style="font-variant-ligatures: no-common-ligatures" class="">?.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures" class="">(while: { $0 != </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">42</span><span style="font-variant-ligatures: no-common-ligatures" class="">}).</span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">forEach</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { i </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">in</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(i)</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div><div class=""><br class=""></div><div class="">But arguing about examples is besides the point, I would like to stop here.</div><div class=""><br class=""></div><div class="">I have a question for you. How do you think we could use this pattern in the generalised situation:</div><div class=""><br class=""></div><div class="">if condiition {</div><div class=""> for thing in condition {</div><div class=""> }</div><div class="">}</div><div class=""><br class=""></div><div class="">for example</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Result<T> {</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> success(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> failure(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Error</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> result: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Result</span><span style="font-variant-ligatures: no-common-ligatures" class=""><[</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">]> = .</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">success</span><span style="font-variant-ligatures: no-common-ligatures" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">])</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">success</span><span style="font-variant-ligatures: no-common-ligatures" class="">(let arr) = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">result</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> e </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> arr {</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(e)</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div><div class=""><br class=""></div><div class="">Maybe it would be nice to write something along the lines of</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> e </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .success(let arr) = result {</span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div><div class=""><br class=""></div><div class="">or even</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162);" class=""><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> e </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> arr </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">where</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .success(let arr) = result {</span></div><p style="margin: 0px; line-height: normal; color: rgb(0, 0, 0); min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div></div><div class=""><br class=""></div><div class="">therefore the "in?" syntax would be sugar for</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> array </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">where</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> array? = test {</span></div><p style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 11 Feb 2017, at 13:22, Tino Heth <<a href="mailto:2th@gmx.de" class="">2th@gmx.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class="">I don't think this use case warrants a syntax change since it can already be expressed quite elegantly with<div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> test: [</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Int</span><span class="" style="font-variant-ligatures: no-common-ligatures;">]? = </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">nil</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">test</span><span class="" style="font-variant-ligatures: no-common-ligatures;">?.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">forEach</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> { i </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">in</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">print</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(i)</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div></div></blockquote><div class=""><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><blockquote type="cite" style="font-family: Menlo;" class=""><div class="gmail_default" style="font-family: georgia, serif;">What about just use</div><div class="gmail_default" style="font-family: georgia, serif;"><br class=""></div><div class="gmail_default" style="font-family: georgia, serif;">test?.forEach { print($0) }</div></blockquote><div style="font-family: Menlo;" class=""><div class="gmail_default" style="font-family: georgia, serif;"><br class=""></div></div><span class="">This works for the simple example, but it isn't as powerful:</span></span></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class=""><br class=""></span></span></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> test = test {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">for</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> i </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);" class="">in</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> test {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i == </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">42</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">break</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">You could add</div><div style="margin: 0px; line-height: normal;" class=""><span class="syntax-keyword" style="box-sizing: inherit; color: rgb(170, 13, 145); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">func</span><span style="color: rgb(51, 51, 51); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px; background-color: rgb(249, 250, 250);" class=""> </span><span class="syntax-identifier" style="box-sizing: inherit; font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">forEach</span><span style="color: rgb(51, 51, 51); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px; background-color: rgb(249, 250, 250);" class="">(</span><span class="syntax-identifier" style="box-sizing: inherit; font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">_</span><span style="color: rgb(51, 51, 51); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px; background-color: rgb(249, 250, 250);" class=""> </span><span class="syntax-param-name" style="box-sizing: inherit; color: rgb(64, 64, 64); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">body</span><span style="color: rgb(51, 51, 51); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px; background-color: rgb(249, 250, 250);" class="">: (Element) </span><span class="syntax-keyword" style="box-sizing: inherit; color: rgb(170, 13, 145); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">throws</span><span style="color: rgb(51, 51, 51); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px; background-color: rgb(249, 250, 250);" class=""> -> </span><span class="syntax-type" style="box-sizing: inherit; color: rgb(92, 38, 153); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">Bool</span><span style="color: rgb(51, 51, 51); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px; background-color: rgb(249, 250, 250);" class="">) </span><span class="syntax-keyword" style="box-sizing: inherit; color: rgb(170, 13, 145); font-family: 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: -0.3569999933242798px; text-indent: -31.999950408935547px;">rethrows</span> </div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">but even this would be less powerful as a loop, which allows you to break, continue or return as you like.</div></span></div></div></div></div></div></div></blockquote></div><br class=""></div></body></html>