<div dir="ltr">Hi Basem,<div><br></div><div>Thank you for the answer. It is indeed a shorthand for unpacking the tuple, which is nothing new to Swift.</div><div><br></div><div>My suggestion is simply to go from this syntax:</div><div>let (name, surname) = ("John", "Doe")</div><div><br></div><div>to this:</div><div>let name, surname = ("John", "Doe")<br></div><div><br></div><div>So it is not about a new feature of the language, simply a small change in the syntax.</div><div><br></div><div>Let me know what you think.</div><div><br></div><div>Thanks,</div><div><br></div><div>Daniele</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-07 20:49 GMT+01:00 Basem Emara <span dir="ltr"><<a href="mailto:contact@basememara.com" target="_blank">contact@basememara.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Daniele, to me at first glance, it looks like a shorthand for creating multiple variables. I would expect to try something like this later: “print(name); print(surname)”, which of course wouldn’t be the intent.<div><br></div><div>Basem</div><div> </div><div><div><blockquote type="cite"><div><div class="h5"><div>On May 7, 2016, at 3:42 PM, Daniele Riccardelli via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">Hi all,<div><br></div><div>I was thinking that the syntax for initialization from tuple is a bit more verbose than needed, i.e. why not simply drop the tuple parentheses and go from this :</div><div><b>let</b> (name, surname) = (<b>"</b>John<b>"</b>, <b>"</b>Doe<b>"</b>)</div><div><br></div><div>to this:</div><div><b>let</b> name, surname = (<b>"</b>John<b>"</b>, <b>"</b>Doe<b>"</b>)<br></div><div><br></div><div>similarly to what Python does with "unpackable" types:</div><div>name, surname = ("John", "Doe")</div><div><br></div><div>This is not a revolution, but if the concern is the trade-off between conciseness and readability, I think this way we are being more concise while not losing points in readability.</div><div><br></div><div>This would of course break existing code, but updating to this syntax would be trivial.</div><div><br></div><div>What do you think?</div><div><br></div><div>Thanks,</div><div><br></div><div>Daniele</div></div></div></div>
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>