[swift-evolution] [Proposal] Property behaviors
2th at gmx.de
Sun Jan 17 08:44:02 CST 2016
Thank you for the thorough explanation — it is an interesting insight in Swift internals and helps to understand some decisions made.
> - First of all, Swift properties are *not* a simple getter-setter pair.
Just out of curiosity: Are there more methods involved, or are the getters & setters just less simple than expected?
In the meantime, I've read the first published draft which was helpful as well:
Correct me if I'm wrong, but my understanding is that behaviors could be seen as property containers that are merged into the object they belong to, right? At least, this model makes the proposed meaning of self inside behaviors more intuitive.
Is there are reason why arrow brackets ("var<lazy> foo…") haven't been considered for declaration?
Both generics and behaviors predefine details at compile time, so I see more similarities than with all other possible types of brackets, which usually have a well-defined meaning.
I guess there is a possible source of confusion if the concept is extended to functions, but imho that could be resolved easily.
Are there already ideas how to use behaviors in other places (functions, subscripts — maybe even types)?
How about behaviors that need parameters? The alternative "keyword"-declaration (I have seen the "by" in Kotlin, so I guess it's a Scala-invention ;-) offers an obvious answer here, but I'm not sure for the other variants.
Would it be possible to add behaviors in subclasses?
I guess most of my questions have already been discussed, but I couldn't find answers in the public archives...
More information about the swift-evolution