I'm not sure if this has been brought up, but I think that the name "property wrapper" should be made more general and more accurate, because these wrappers do not only apply to properties, but also local/global variables. I believe this feature should be called variable wrappers.
1. Local and global variables are not properties, but "property wrappers" are designed to apply to them.
According to the official language reference, var
declarations in a global or local scope are not called "properties"—they are called "variables".
Global and Local Variables
The capabilities described above for computing and observing properties are also available to global variables and local variables . Global variables are variables that are defined outside of any function, method, closure, or type context. Local variables are variables that are defined within a function, method, or closure context.
The following line in the proposal can be revised to
-Property wrappers can be applied to properties at global, local, or type scope.
+Variable wrappers can be applied to variables at global, local, or type scope
+ (in which case, variables are properties).
2. "Variables" generalizes both local/global variables and var
properties.
let
constant properties are also properties, but "property wrappers" do not apply to let
properties because they cannot have a getter. The word "property" may cause confusion to the user because one may assume that "property wrappers" apply to all properties.
The word "variable", on the other hand, accurately describes both local/global variables and var
properties. The official language reference even uses the word "variable" to define a var
property:
Stored Properties
In its simplest form, a stored property is a constant or variable that is stored as part of an instance of a particular class or structure. Stored properties can be either variable stored properties (introduced by the
var
keyword) or constant stored properties (introduced by thelet
keyword).
As such, I believe the word "variable wrapper" is a much more accurate name than "property wrapper", and will not cause the wrong implication that these wrappers can apply to let
constants.