ucblogo-code
ucblogo-code copied to clipboard
MYNAMEP for child object
? make "a something
? ask :a [have "bar]
? ask :a [make "bar "baz]
? ask :a [show mynamep "bar] ; [1]
true
? show mynamep "bar ; [2]
true
The output of [1] makes sense to me; bar
is a variable owned by the current object.
[2] does not. The Logo object does not own bar
.
...continuing
? make "b kindof :a
? ask :b [have "joe]
? show mynamep "joe
true
? ask :a [show mynamep "joe]
false
? ask :b [show mynamep "joe]
true
The hierarchy looks like this:
B -> A -> Logo
B
is a child of A
, and A
is a child of Logo
.
We ask B
to have a variable named "Joe". Then we ask all three of them, "Who has 'Joe'?"
B
and Logo
say they do, but A
says it doesn't.