I reiterate my comment from the pitch thread that because a computed property that cannot formally mutate the struct (one that either doesn't have a set
or has a nonmutating set
) is declared with var
, and because property wrappers that similarly cannot mutate the struct are also declared var
, it is most consistent for weak
to be declared with var
instead of let
. I do agree that there is value in declaring a weak
property or property wrapper's backing storage to be immutable, but it should be done another way (if the complexity in added syntax is a worthwhile tradeoff). The existing precedent is that a computed property/property wrapper is always declared with var
even if it cannot mutate the backing storage, and we indicate that the backing storage is immutable not through let
, but through the computed property either not having a set
or having a nonmutating set
.
2 Likes