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

Haravikk swift-evolution at haravikk.me
Sun Feb 14 16:35:18 CST 2016

> On 14 Feb 2016, at 11:08, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>> I ask again:
>> What is wrong with arrow brackets?
>> var<lazy> foo
> 	var<lazy, synchronized> foo: Dictionary<Int, Set<Optional<String>>
> So, two problems:
> • Angle brackets already appear in var declarations for generic types; that means there are two different meanings for angle brackets in the same construct.
> • When we eventually allow you to apply multiple behaviors to a single property, that will also mean that *commas* are used in both of those angle bracket constructs, but with different meanings (one means "chain these", the other means "fill these two slots").
> These are not fatal errors, but they're also completely unforced—either `[]` or `{}` would not have this problem. So why choose the option that has the problem?

Do we need braces and commas at all? It seems to me that you can just do:

	var lazy synchronized foo: Dictionary<Int, Set<Optional<String>>>

The name is always the one right before the colon, so this actually seems fine to me. If Xcode can colour them differently then it shouldn’t be hard to follow IMO. The order implies the order in which they are resolved where relevant, i.e- foo is mutable, then lazy, then synchronised.

More information about the swift-evolution mailing list