[swift-evolution] [Pitch] Removing Setter/Observer Name Overrides

Matthew Johnson matthew at anandabits.com
Sun Dec 4 07:32:37 CST 2016



Sent from my iPad

On Dec 4, 2016, at 4:31 AM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:

>> On Dec 3, 2016, at 7:06 PM, Erica Sadun <erica at ericasadun.com> wrote:
>> 
>> A majority of respondents prefer that argument names always be mentioned, 
>> whether or not they *can* be omitted. Consensus is that it's unSwifty
>> to use pre-built `newValue` and `oldValue` arguments without mentioning
>> them first.
> 
> For what it's worth, I don't agree that the default names are a problem. I think they're a helpful convenience which, nevertheless, must occasionally be overridden because they conflict with the name of something else. The names are well-chosen and virtually always read correctly.
> 
> (Also FWIW, I'm not sure I've ever explicitly named the `oldValue`/`newValue` variable rather than using the implicit names.)
> 
> I think a warning on using `oldValue` instead of `newValue` or vice versa would be very helpful and address the parts of this proposal which aren't motivated by mere style complaints. The rest I think is a style issue, and I don't think that style issue is nearly universally-agreed-upon or serious enough to motivate a breaking change affecting tons of property setters, property observers, and subscript setters.

+1

> 
> -- 
> Brent Royal-Gordon
> Architechies
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list