|
Problem:
You want to declare an attribute of a class. Solution:
Use the
Discussion: Attributes of a class are created using a syntax almost identical to that used to create variables in packages. You optionally may specify the the, properties, and initial value for the attribute: the "initial value" is the value that the attribute will be initially set to in every new instance of the class. See the next recipe for tips on how to access attributes once you've created them. Issue: Is the sigil optional, if it can be inferred from the type? Issue: Is the '.' optional, since it is redundant w/ 'has'? Issue: Maybe an optional 'strict'ness to enforce that every attribute must be declared with a type?
|