(no subject)

goran.krampe at bluefish.se goran.krampe at bluefish.se
Wed Jun 23 10:34:48 UTC 2004


Cancerbero <sgurin at montevideo.com.uy> wrote:
> Hi smalltalkers!
> First of all excuse me for my bad english. I have a question to ask
> but i have fear of make ridiculous.

Not a problem at all, this is a friendly list! :)

> Think of me as a Smalltalk 
> novice that haven't (and is not shure of wanting) read about Object
> Technology and/or Object Oriented programming paradigms. 
> Suppose that obj1 is an instance variable of the class C and has the
> instance variable inst1. My question is how inst1 could have access
> to obj1? 
> >From what I have seen in the flexibility of Squeak, should
> be trivial found the method Object>>isInstanceVariableOf (or
> whatever) that returns the object that "possess" the receiver as an
> instance variable. But I couldn't find a method for doing that. Such
> a kind of method exist? If not, why?

Well, you can search for those objects using say:

	Smalltalk pointersTo: self

But generally when an object needs a reference to it's "parent" you will
have to give it to it when you create the instance. Something like:

myObject _ SomeClass newWithMeAsOwner: self.

regards, Göran

More information about the Squeak-dev mailing list