[swift-evolution] [Proposal] Property behaviors

Jordan Rose jordan_rose at apple.com
Mon Dec 21 19:17:39 CST 2015


> On Dec 17, 2015, at 23:50 , Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I actually think that behavior instances should probably be private, and there should be no way to change that. Behaviors are inherently an implementation detail, and you should not be exposing them directly to users of your type. Instead, you should expose just the operations you expect to be needed through your own calls, which you can reimplement as needed.

I'm leaning in this direction too. The idea of exposing the behavior itself as a value seems wrong for almost any client. "foo.prop.reset()" is slightly nicer than "foo.resetProp()", but not if it conflicts with a 'reset' that's already on the property type. "foo.prop at behavior.reset()" certainly isn't an improvement.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151221/8bc2bbfe/attachment-0001.html>


More information about the swift-evolution mailing list