[swift-evolution] Support for pure setters

Andrey Tarantsov andrey at tarantsov.com
Thu Feb 4 12:25:14 CST 2016


> IMO, a good setter behaves like it's setting a variable, because this is exactly what the assignment operator suggests. That is:
> you should be able to replace a sequence of writes to a setter by a single write with the last value and still have essentially the same end result;
> you should be able to reorder setter operations and still essentially get the same end result.
> "Essentially the same end result" means that it's okay if the logging output is different or if you wasted cycles in the process.

This.

On the other hand, we have WatchKit as a counter-example. I'm surprised nobody mentioned it. It's full of setters for properties that match the typical UIKit properties, but cannot be read.

A.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160205/451b96dd/attachment.html>


More information about the swift-evolution mailing list