[swift-evolution] [Proposal] Property behaviors

Joe Groff jgroff at apple.com
Wed Dec 23 11:07:04 CST 2015


> On Dec 22, 2015, at 8:42 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> You shouldn’t have to say myProperty.lazy.backingStore.clear(), just myProperty.lazy.clear().
>> 
>> I don’t know where that leaves us :-)
> 
> I wonder if these should all just be flattened into the instance that owns the property. So instead of saying foo.myProperty.lazy.clear(), you just say foo.clearMyProperty() or some such. That approach isn't very principled, but it *is* very convenient.

I agree that "myProperty.clear()" is very appealing, but it has the potential to be confusing when behavior methods are shadowed by members of the front-facing property. You'd still need a way to unambiguously refer to behavior methods when they're shadowed too.

-Joe


More information about the swift-evolution mailing list