
Combining Proto and Parent Inheritance
Testing for the Existence of Slots
There are also a number of different ways to test whether a slot exists. TABLE 4.3 summarizes these methods.
Different ways to test for the existence of slots.
Syntax | Example | Uses Proto Inheritance | Uses Parent Inheritance |
slot exists | slotA exists | X | X |
frame.slot exists | self.slotA exists | X | |
frame.(pathExpr) exists | self.('slotA) exists | X | |
frame :slot exists | self:MethodA exists | X | X |
HasVariable(frame, symbol) | HasVariable(self, 'slotA) | X | X |
HasSlot(frame, symbol) | HasSlot(self, 'slotA) | | |
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996