[swift-evolution] [Proposal] Property behaviors

Michel Fortin michel.fortin at michelf.ca
Fri Jan 15 07:34:00 CST 2016


Le 15 janv. 2016 à 8:19, Michel Fortin via swift-evolution <swift-evolution at swift.org> a écrit :

> Maybe this should be the way to access functions inside behaviours:
> 
> 	&myvar.resetable.reset()
> 
> By using `&myvar`, we indicate that we want access to the variable, not its value, similar to how it works with `inout`. This would also fit well with a future extension where you could access behaviours through `inout` arguments.
> 
> Also, I think it's important that behaviour functions be accessible skipping the behaviour name. This syntax works well for this:
> 
> 	&myvar.reset()

And ten seconds after posting, I realize this would be ambiguous with `inout` in cases like this:

	foo(&myvar.somefield)

so, nevermind.

-- 
Michel Fortin
https://michelf.ca



More information about the swift-evolution mailing list