[swift-evolution] [Proposal] Property behaviors

Michel Fortin michel.fortin at michelf.ca
Fri Jan 15 07:19:20 CST 2016


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()

If more than one behaviour implement a reset function, or if one of the behaviours is called `reset`, then you have to disambiguate using the behaviour name as a prefix.

-- 
Michel Fortin
https://michelf.ca



More information about the swift-evolution mailing list