(no subject)

Cancerbero sgurin at montevideo.com.uy
Wed Jun 23 03:39:57 UTC 2004


Hi smalltalkers!

First of all excuse me for my bad english. I have a question to ask
but i have fear of make ridiculous. 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? Investigating a little in my
Squeak3.4 I found that can be made easily: 

isInstanceVariableOf

"returns a collection of the objects which self is an instance
variable of. Very Slow! Don't try this at home"

| b |

^Smalltalk allObjectsSelect: [: i | 
	b:=false. 
	1 to: (i class instSize) do: [: j |
		b:=b or: [(i instVarAt: j)==self]
	]. 
	b]

In Squeak3.7b i can't find SystemDictionary>>allObjectsSelect. In
fact I can't find SystemDictionary>>all***... Where are they?

Thanks for reading. Bye
-- 
Sebastián Gurin (Cancerbero)
cancerbero_sgxARROBAusers.sourceforge.net
http://www.geocities.com/cancerbero_sgx

Roqueros bonitos, educaditos.
Con grandes gastos, educaditos.
Emboquen el tiro libre,
que los buenos volvieron,
y están rodando cine de terror.



More information about the Squeak-dev mailing list