Here's the set of things I want to revise:
- Give the
private
storage property a consistent name_<property name>
regardless of whetherwrapperValue
is present. The leading underscore aligns with existing conventions. So the desugaring of@A public var foo: Int
always has the basic form of:
private var _foo: A<Int>
public var foo: Int {
get { _foo.wrappedValue }
set { _foo.wrappedValue = newValue }
}
- When
wrapperValue
is present, the$foo
property becomes available and has the same access level as the original propertyfoo
, so whenA
has awrapperValue
(say it returns aRef<Value>
), the above example adds on:
public var $foo: Ref<Int> {
get { _foo.wrapperValue }
set { _foo.wrapperValue = newValue }
}
-
Rename
wrapperValue
toprojectedValue
, so that (1) it's not so close towrappedValue
and (2) gives us a specific term to use to talk about the$
property as the "projected property", a term that's been used a bit in the discourse here and describes the use cases well.Doug
EDIT: I dropped in the names I'm planning to use, which is based on subsequent feedback on this thread. A revised proposal + implementation is forthcoming.