[swift-dev] Disallowing weak struct properties

John McCall rjmccall at apple.com
Fri Jan 29 20:22:15 CST 2016


> On Jan 29, 2016, at 5:56 PM, Jordan Rose via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi, everyone. What do you think about dropping support for 'weak' in struct properties? This would fix a semantic issue—'let' structs containing weak properties won't change out from under you

Is there a formalizable notion of “change” here that doesn’t include changes in mutable referents and that isn’t just restating bit-equivalence?

> —and (AFAICT) would make all values trivially movable, which is a great quality to have.

If you sweep “unowned" up with “weak”, yes, this is true of the current language.  It’s not an obvious restriction that we want to adopt forever, though.

John.


More information about the swift-dev mailing list