Frames

Creating Slots

Creating a slot is as disconcertingly easy as creating a frame. Just use a new slot name in the frame in an assignment. To add the foo slot to our v frame, do this:

v := {name: "Neil", height: 73.25, children: 3};
v.foo := 17;
foo now exists in v.


Note:It is slower to add a slot on the fly than it is to assign to an existing slot (memory allocation is necessary when the frame gets a new slot). The prudent course is obvious: if you know which slots you need, create them when you create the frame.


Multilevel Slot Creation

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

Last modified: 1 DEC 1996