Here's the set of things I want to revise:
- Give the
privatestorage property a consistent name_<property name>regardless of whetherwrapperValueis present. The leading underscore aligns with existing conventions. So the desugaring of@A public var foo: Intalways has the basic form of:
private var _foo: A<Int>
public var foo: Int {
get { _foo.wrappedValue }
set { _foo.wrappedValue = newValue }
}
- When
wrapperValueis present, the$fooproperty becomes available and has the same access level as the original propertyfoo, so whenAhas awrapperValue(say it returns aRef<Value>), the above example adds on:
public var $foo: Ref<Int> {
get { _foo.wrapperValue }
set { _foo.wrapperValue = newValue }
}
-
Rename
wrapperValuetoprojectedValue, so that (1) it's not so close towrappedValueand (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.