Frames

Accessing Slots


frame.slot


You use the dot (.) operator to access a slot (a frame element). For example:

x:= v.left + 3;
The code first retrieves the value of the left slot within v, adds 3 to it, and then assigns it to x.

Of course, since any frame can appear to the left of the dot operator, you could even write this convoluted code:

{left: 10, right: 20, top: 10, bottom: 100}.left
in a Byzantine attempt to obtain the value 10.

There are also a number of other ways to access slot values. They differ in how inheritance affects them and are covered in the discussion of inheritance in "Accessing Slots" on page 99.

Accessing a Nonexistent Slot

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

Last modified: 1 DEC 1996