[swift-evolution] [Proposal] Property behaviors
Matthew Johnson
matthew at anandabits.com
Fri Dec 18 09:05:44 CST 2015
> A behavior declaration
>
> This has promise as well. By using a declaration like this, you can have basically a DSL (using contextual keywords) to specify things like whether it's lazy-initialized, decorators, and transformers. Same benefits as the protocol family (e.g. good compiler checking of the behavior definition before it's even used anywhere), allows for code code-completion too, and it doesn't litter the global function namespace with behavior names.
>
> The more I think about this, the more I think it's a good idea. Especially because it won't litter the global function namespace with behavior names. Behavior constructors should not be callable by the user, and behaviors may be named things we would love to use as function names anyway (if a behavior implements some functionality that is useful to be exposed to the user anyway, it can vend a type like your proposal has and people can just instantiate that type directly).
>
+1 to these comments. I think this option should at least be fleshed out further and receive serious consideration.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151218/51dae5c9/attachment.html>
More information about the swift-evolution
mailing list