
Symbols and Path Expressions
frame.(pathExpression)
3.
'x.
pathExpr containing symbols and/or integers.
[pathExpr: 'x, 'y, 'z]
It is an acceptable shortcut to separate symbols by periods (.) when the array doesn't contain any integers. Thus, the following is equivalent to the previous array:
'x.y.z
You will use this type of indirection when you want to decide what slot to access at run time instead of compile time. Here is an example that uses this type of expression:
func()
begin
local aFrame := {x: 1, y: 2, z: 3};
local slotToAccess;
if ... then
slotToAccess := 'x;
else if ... then
slotToAccess := 'y;
else
slotToAccess := 'z;
...
aFrame.(slotToAccess) := 6;
end;
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996