[swift-evolution] [Review] SE-0030 Property Behaviors

Brent Royal-Gordon brent at architechies.com
Fri Feb 19 14:34:32 CST 2016

> I'm having trouble wrapping my head around the difference between accessors and methods defined by a property: AFAIU accessors are like abstract methods if required and just like methods if not, whereas methods are like final methods as they cannot be overridden in a property use site.

Accessors are more like property requirements: they're meant to be customization points, but you can provide a default implementation. Methods defined in a property are for (a) code organization and (b) eventually, exposing additional functionality related to the property to users. No customization allowed.

> If I did understand this correctly then I'd prefer that instead of "accessor" we would just use "func" and introduce a new keyword "abstract". The latter can then be extended to  classes in another proposal.

I don't think "abstract" is the right keyword to use, but I do agree that "accessor" might not be the perfect term for this feature. Not sure what would be better, though.

Brent Royal-Gordon

More information about the swift-evolution mailing list