jrincayc / ucblogo-code

Berkeley Logo interpreter
https://people.eecs.berkeley.edu/~bh/logo.html
GNU General Public License v3.0
182 stars 34 forks source link

MYNAMEP for child object #155

Open jasonsikes opened 1 year ago

jasonsikes commented 1 year ago
? 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 commented 1 year ago

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