Frames

Slot Existence


frame.slot exists


To test for the existence of a slot in a frame, use the exists operator. Given this frame:

x := {a: 1, b: 2};
you might use exists in this manner:

if x.a exists then 
   Print("a is a slot in x");
or:

doesFooExist := x.foo exists;
if doesFooExist then
   Print("uh-oh, foo shouldn't be a slot in x");
You can also determine slot existence in other ways. The methods vary, however, in how they deal with inheritance (for a discussion of the alternatives, see "Using self in a Method" on page 100).


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996