richard.eng at rogers.com
Wed Jan 16 17:25:08 UTC 2008
I'm not finding this to be true. I have a class #GSAssignmentList. It has
instance variable #clientId and accessor #clientId:. I do the following:
self call: (GSAssignmentList new clientId: aValue)
In the #initialize method for GSAssignmentList, I write to the Transcript:
Transcript cr; show: 'RKE: clientId = ', clientId asString.
It shows 'nil'.
In #renderContentOn:, I write to the Transcript and get aValue, as expected.
This is contrary to what you're telling me *if* the object is created with
#clientId = aValue *before* #initialize starts to execute.
You see, I need the value of aValue in order for #initialize to complete.
Zulq Alam wrote:
The instance variables and methods, including accessors, exist when the
object is created. They do not depend on the initialize method. Thus you
can access any instance variable or call any defined method, such as
accessors, at any time after creation. Whether they have a value or
return anything useful depends on your object and how you *chose* to
The use of #initialize is a convention to set-up object state *after*
the object has been created.
More information about the Squeak-dev