Stupid Question?

Tom Phoenix rootbeer at redcat.com
Wed Jan 16 17:48:06 UTC 2008


On Jan 16, 2008 9:25 AM, Richard Eng <richard.eng at rogers.com> wrote:

> You see, I need the value of aValue in order for #initialize to complete.

In that case, you probably want to move that part of the
initialization code out of #initialize, and then write something like
this:

  MyClass>>clientId: aValue

    clientId := aValue.
    self adjustForClientId: aValue.

Of course, you'll also have to allow for the possibility that an
object may sometimes not be fully initialized. For example, your
#printOn: method may look like this:

  MyClass>>printOn: aStream

    clientId ifNil: [^super printOn: aStream].
    ....

Hope this helps!

--Tom Phoenix



More information about the Squeak-dev mailing list