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

Jacob Bandes-Storch jtbandes at gmail.com
Sat Feb 20 01:33:48 CST 2016


On Thu, Feb 18, 2016 at 6:56 PM, Joe Groff via swift-evolution <
swift-evolution at swift.org> wrote:

> Based on review feedback, I've revised the declaration syntax proposal for
> property behaviors to be more in line with our other declaration forms,
> reverting to the earlier pre-review "var behavior" proposal. I've updated
> the proposal in swift-evolution:
>
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0030-property-behavior-decls.md
>
> In discussion with the core team, we've also strongly come in favor of
> applying behaviors to properties using attribute syntax, e.g.:
>
> @lazy var x = 111
> @delayed var x: Int
>
> They're definitely attribute-like, and we think it makes sense for
> behaviors to be the first of hopefully many kinds of user-defined
> behaviors. What do you all think of this direction?
>
> -Joe
>

I think this is a good direction, however I'm concerned about possible
namespace conflicts here. Does user code break if someone defines an
attribute which becomes part of the standard library in a future Swift
version? Can multiple modules declare attributes with the same name? Maybe
they can be qualified as "@MyModule.lazy var x" — although this would also
conflict with syntax like "x. at lazy.foo" (is this a "lazy" attribute or a
"foo" attribute in a "lazy" module?).

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


More information about the swift-evolution mailing list