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

Patrick Smith pgwsmith at gmail.com
Fri Feb 19 14:11:27 CST 2016


Hi all,
Has the following syntax for applying behaviors been considered?
class Example {  var foo: Int {    @json(key="bar") // `internal` by default  }}
If the behavior is not public, then all the outside world sees is `var foo: Int`, which is consistent as what is written on the first line of the declaration.
It’s at the same level as a `get`, `set`, `didSet` etc, and just like those, it’s an implementation detail wrapped inside the property declaration. There is a clear hierarchy.
I think is more readable, especially if any attribute was a closure.
For now, before composability support only one single behavior is allowed, but this also considers legibility for multiple behavior declarations.
Kind Regards,
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160219/9b6b3633/attachment.html>


More information about the swift-evolution mailing list