<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=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 30 janv. 2016 à 20:50, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class="">+1 for `bind`. I dislike the use of the same keyword for two different purposes. Also `if let x = x` is confusing for beginners (by beginners I mean beginners to Swift not to programming) since:<div class=""><br class=""></div><div class=""> 1. `let x = x` is, outside of binding, an error. </div><div class=""> 2. Beginners quite rightly say "`x` already equals `x`!".<br class=""></div></div></blockquote><div><br class=""></div><div>For me, the keyword bind should not be limited to this kind of nil check. but act a bit like an alias. Unfortunately, I cannot come up with nice Swift example; and not sure yet if an aliasing concept is applicable to Swift. For example in C, it is quite common to do:</div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">myStructType *myStruct = (*myStruct) someVoidPtr;</div><div class=""><br class=""></div></div><div>Or you can do</div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">myStructType *myStruct = &nested.structs.array[index];</div><div class=""><br class=""></div></div><div>So that you can use the short name for the heavy work. For read-only operation, the let keyword can be used in that way; but there’s seems to be no easy way if one want to mutate the original data (you are welcome to prove me wrong, my Swiftness is limited)</div><div><br class=""></div><div>On the "let x = x" being illegal outside binding, maybe we should make it illegal too for optional binding, especially that the optional binding with var will be reintroduced. This shadowing make it simple when you change your variable from non-optional to optional, as you just wrap the code in the "if let x=x", re-indent the code and voilà; if prohibited one will need to rename all the x by y inside the re-indented code. But such shadowing as its detractor, after all troubles hide in the shadow. But I’ll leave this to be discuss in another thread if someone fells like starting a long and painful discussion, with three battle camps: should allow let x=x, should be an error, should be a warning.</div><div class=""><br class=""></div><div class="">Dany</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">On Friday, 29 January 2016, Joe Groff via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
> On Jan 28, 2016, at 10:05 AM, Erica Sadun <<a href="javascript:;" onclick="_e(event, 'cvml', 'erica@ericasadun.com')" class="">erica@ericasadun.com</a>> wrote:<br class="">
><br class="">
> Do you realize how much confusion it would save if Swift just went with<br class="">
><br class="">
> if bind foo = bar {...}<br class="">
><br class="">
> with let semantics?<br class="">
<br class="">
I don't see how changing the keyword changes anything, no.<br class="">
<br class="">
-Joe<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div><br class=""><br class="">-- <br class=""> -- Howard.<br class=""><br class="">
_______________________________________________<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=""></body></html>