[swift-evolution] [Review] SE-0030 Property Behaviors

Joe Groff jgroff at apple.com
Fri Feb 19 12:21:34 CST 2016


> On Feb 18, 2016, at 9:01 PM, Curt Clifton <curt at curtclifton.net> wrote:
> 
> I find the naked `initialValue` “declaration" quite odd. It’s not exactly a declaration even. What are the implications for parsing? If we’re already willing to special case`initialValue` in the parser in this context, perhaps we could introduce a binding list instead, like:
> 
> ```
> public var behavior lazy<Value>: Value {
>   // Behaviors can bind the property's initializer expression with a
>   // binding declaration.
>   bind initialValue
>> ```
> Besides eliminating the odd naked “declaration”, this has the added advantage that it could be extended to `bind initialValue, propertyName`. :-)

Yeah, I'm not happy with it either. An alternative might be to bless a specifically-named `accessor` declaration, e.g.:

var behavior lazy<Value>: Value {
  accessor initialValue() -> Value
}

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160219/f6bfbac0/attachment.html>


More information about the swift-evolution mailing list