[swift-evolution] Draft proposal: multi-property assignment .= operator

Tino Heth 2th at gmx.de
Sun Jan 10 17:12:00 CST 2016

Methods like "setValuesForKeysWithDictionary" can indeed be very handy — but its name is quite verbose, and imho that isn't that bad:
It's hard to guess the meaning of ".=" (I'd prefer "<-" instead, but I guess depending on the background of the reader, this may be as hard to understand)

A method with the functionality would be nice, and the possibility of compile time checking would make it better than the variant with dictionaries — but to make the check working, this method would need special treatment by the compiler, and that would appear strange to me.

You've written about the older proposal sketches for cascading; have you seen the following idea?
	property1 = 1
	property2 = "a"
It is a less flexible in some aspect (the tuple in your draft could be created by a function call*), but is even more concise (not much, though) and can be used for more than assigning properties.

Best regards,

* If you continue with your draft, I suggest to explore this possibility further: With a function to turn members of an existing object into a tuple, or the option to selectively remove elements from a tuple, it could be a handy way to create copies.

More information about the swift-evolution mailing list