ucblogo-code icon indicating copy to clipboard operation
ucblogo-code copied to clipboard

MYNAMEP for child object

Open jasonsikes opened this issue 2 years ago • 1 comments

? 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.

jasonsikes avatar Feb 06 '23 22:02 jasonsikes

...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.

jasonsikes avatar Feb 06 '23 22:02 jasonsikes