
SMALLTALK-72
INSTRUCTION
MANUAL
ADELE GOLDBERG AND
~
~
ALAN
KAY, EDITORS
\ \
\
\

SMALLTALK-72
INSTRUCTION MANUAL
Adele Goldberg
The
Learning
Xerox
Palo
Alto
March,
Copyright © 1976
and
Alan
and
Research
Hesearch
1976
by
Xerox
Kay,
editors
Group
Center
Corporation

SMALLTALK-72
INSTRUCTION MANUAL
Adele Goldberg
SSL
76-6
The
Smalltalk-72
Xerox
used for
Small
talk
Small
talk
receiving,
Many
names,
all
of
examples
editing
reading
March,
Interim
interacting
programs.
is
and
classes
arithmetic,
these
basic classes is
that
definitions,
input
and
Alan
1976
instruction
Dynabook.
built.
the
notion
have
already
information
use
these
saving
devices.
Kay,
The
with
the
Chapter
These
include
of
classes
been
given
basic classes.
and
editors
manual
first
Small
III
goes
and
built
storage
in
retrieving
is
intended
two
chapters
talk
deeper
the
method
instances.
for
the
methods,
Chapter
Chapter
files
system
into
user's
IV;
IV also
of
for
use
by
those
consist
and
the
of
convenience.
text
Chapter V then
information,
of
an
for
creating,
basic
evaluation
display,
describes
persons
introduction
concepts
of
These
and
graphic
presents a number
utilities
viewing
with
on-line
to
some
of
editing,
from
messages, message
include
definitions,
which
control.
already
saving
everything
the
various
The
provided
testing
access
the
methods
and
retrieving
sending
clal\ses
definitions
of
interesting
the
user
values,
to
else
the
in
and
for
of
for
and

The
Small
talk
system
with a user
Center
version
This
manual
such,
it
also
maintains a somewhat
references
meaning
files
that
information
access
The
purpose
not
generally
(no
younger
noted
readers
Small
talk
developing
Many
hard
to
implementation
color
Ingalls,
Weyer
of
System
McCreight,
Laboratory.
late
(PARe)
of a
small
is
employs a tutorial
to
peripheral
mainly
are
needed
on
to
the
Small
of
available
than
here.
Because
without
by browsing
their
people
graphics,
develop
Chris
of LRG;
Science
Bob
(both
Jeffers,
described
that
fall.
in
spring
computer
intended
in
the
in
how
to
talk
making
high
school
an
access
own
experimental
from
the
systems
of
the
and
network
Ted
David
Boggs,
Laboratory;
Metcalfe,
It
1973
system)
for
use
style
informal
devices,
context
order
obtain
system
public
is to
through
Small
library.
an
ease
age)
attempt
to
the
the
Learning
described
talk
communications.
Kaehler,
Bill
Mike
here
was
was
released
when
the
became
by
those
that
directs
dialog
such
as a keyset, a mouse, a display
of
the
to
follow
these
files.
instructional
the
distribution
who
is
made
Small
talk
these
pages.
Small
language,
Diana
Bowman,
and
Patrick
Overton,
Preface
designed
for
first
available.
persons
immediate
about
Interim
the
Such
will,
in
to
describe
on-line
Furthermore,
talk
environment.
Research
in
this
real-time
Merry,
Bob
Baudelaire,
Bob
in
the
more
"Interim
with
expected
Dynabook.
suggested
information
manual
of
instructional
fact,
have
materials
Group
manual
We
take
Dave
Flegal,
Sproull,
summer
general
Dynabook"
on-line
experimentation
results
sequence
about a language
access
graphic
and
and
music
space
Robson,
Larry
Larry
and
of
1972
use
at
(a
access
of
such
Furthermore,
for
is
only
information
to
the
results
may
still
the
manual
from
other
accompanying
synthesis,
here
John
Tesler,
Clark,
Chuck
Jim
Thacker
and
first
the
Xerox
name
for
the
to
the
Interim
with a Small
experimentation.
screen,
experimentation
useful
Small
of
gain
groups
animation,
to
Shoch,
'rruett
and a disk,
the
manual
to
those
implemented
to
talk
system
running
some
may
assist
at
PARC)
documents--the
mention
Dick
Thach,
Cucinitti,
of
the
conversed
Palo
Alto
current
Dynabook.
talk
references
and
persons
on a computer
school-age
and
example
information
these
have
retrieval
their
names:
Shoup,
and
Bill
Peter
Deutsch,
Computer
haltingly
Research
working
systemj
There
that
have
disk
provides
having
students
materials
programs,
about
readers
worked
design
methods,
Dan
and
Steve
Winfield
Science
As
it
are
in
and
Ed
iii

TABLE OF CONTENTS
Chapter
I.
INFORMAL
Introduction
To
Get
The
Mouse
Talldng
Helpful
Try
A
Layout
Dialog
A
First
Font
Chapter
Simple
How
GeneraliziIlg
FixiJlg
Saving
Diagllosis
Special
Editing
II.
Manipulation
to
ORIENTATION
Started
to
Smalltalk
Notes
Turtle
of
the
Small
Windows
Note
on
Slnalltalk
Windows
WRITING
of a Simple
Edit
Your
tIle
Defini
YOllr
all{l
Dialog
Retrieving
Window
Cllaracters
........•••....••••.....••••••...••.•••..•...•••••.....•...••.•.•..•••.....•......••••••.
.....••••.•.••.•..•.....•.•••.••...••........••..•.•.•........•....•..................•..
AND
talk
SMALLTALK
Definition
tion
OVERVIEW
Screen
Classes
OF
THE
initial
comments
how
to
load
a disk
is
what
we
point
how
to
evaluate
how
to
handle
make a square
display
how
what
how
to
is a
to
screen
use
some
class
design
SMALLTALK
on
Smalltalk
and
get
Smalltalk
with
...........................
3+4
••••••••••••••••••••••••••••• 2
typing
coordinate
characters
and
other
and a squiral
system
Small
talk
dcfinition
••••••••••••••••••••••• 6
.......................
••• ••••••••••••••• 3
windows
PROGRAMS
Program
......•........•.•..•.....•..•.••....•...••....••.....•.•.......••.•••.
of
Sq
uare
..................................................... 9
•....•...•....•.......•......•.••.............•.•.••
SYSTEM
•••••••••••••••• l
•••••••• 1
errors
.............
••••••••• 5
...........•...•.....•......•••....•.•.....••••.••.••...••................••.....••...•
11rograms
.....•..............•......................................•.....
2
•••••• 2
4
7
10
11
13
14
14
15
Boxes:
A
An
Look
Alternative
Class
Turtles
Boxes
of
••
Owning
Dispframes:
Placillg
Boxes
A
Few
Paint
BI"rBLTing
as
Sketching
Brush
Introduction
at
the
Class
Box
Polygons
I.
I I I
•••••••••
I
•••••• I •••••••••
Turtles
An
In
Text
on
MelIUS
Tricks
to
Small
Box
Definition
talk
..............................................................
....•........•.••••.•...•....•.•••••..............•.•......•••••......•.•••.•
.........•........•...•.•...•.•....•................•.•.•.•....•...•.••.•
...................•.......•...................•••.•..•.....................•.•....•....•.
I
•• I ••••••••••••••
..•.........
trod
uction
the
Display
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
1
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
to
Text
Screen
I
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Display
..............................................
•.•••....•...•••.•..•....................••.•......•.....
.....................................................................................................
.........................................................................................................
.....••..............•...............•....•...•.•..............................•..•••.•...........••
17
18
24
26
27
29
30
30
32
36
40
42
iv

Chapter
III.
THE
SMALLTALK
WORLD
AND
ITS
PRIMITIVES
Objects
Message
The
The
TIle
A
Chapter
The
Basic
Atoms
Ari
Turtles
The
Sequen
Dispframe:
Point
Aids
The
Sllowing
Saving
Saving
Utilities
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••.•.•••••••••••••••••••••••••••••••••
Notion
User
Form
Small
IV.
Sending
of a Class
Task
of
talk
BASIC
System
and
Receiving
•••..•.•••••••••••.•.•••••.••••••••••••••••••••••.•••••••••••••.••
.••••..•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••.•••••••••••
••.••••••••••••••.••••••••••••••
Presentation
Class
Example
of
•.•••••••••••••••••••••••••••••••.•••••••.••••••••••••••••••••.•••••••••••
SMALLTALK
II
II
Classes
SYSTEM
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
••••.••••••••••••••••••••••••••••••••••••••••••••••••••••
CLASSES
AND
UTILITIES
Classes .........................................................................•.......
......•.••.•..•••••..••••....•..•.....•.••••.•....••.•.•.•••.•.....•..••.•....••.••..••......••.•....••.•••.•
tlllTletic
False
Class
for
Interacting
SDlal1
••••••••.••••••••••••••.•.••••••••••.•••••••••.••••••.•••••.••••••••••••••••••••••••••••••••••••••.•
for
Class
tial
Dictionaries
Drawing
..................•.••.•..•.........•..........•••••...•.•...•..•.•.•.•......••.•.•••••.•.•.•
The
••....•.••••..•.•••••....••...•••••.•..•.•...•••...•••••.•••••••••••.•••••.••.••••.•
....•.••••.•••.•......•.•....•••.•.••.••..••.•••.••••..•••.•.•••.•.••.•.•••••••.•
Basic
Window
Class
....•......••••••.••.•.••••••••..•••...•..•••..•••••••.••
.•..••••.•••...••....••••..•.••••.••••...••..••..••....•••....•..•••.••...•.....••••••..•...•••.••..•
talk
Stored
SInalltalk
and
Restoring
with
Class
InforJ11ation
Defillitions
Smalltalk
Edi
tor
Your
...............................................................
.••.....••..••..••••..••.•....•.••..•.•...••.•••..••••.••.••.••••••••...••
..•••••••.•••••••••••••••••.•••••••••••.••.•••••••••••••••••••••••••••.•
.......•........•......•••••...•...........•.••..........•••..••••..•..•
Context
...•....•..•..•.•..........•...•••.•••..••..••••...••.•.••..
.....•.•..•.•...••••.••...••..••.•.•••.••••...........••.•.•.•.•.•..•••.•..••.•••.••.•.••..•••...•••.•..••
44
44
48
51
53
55
56
56
67
60
61
62
69
73
74
74
75
75
76
77
Chapter
Ari
Sequential
Dispfratne
Point
Turtles
Control
A
Classes
INDEX
EXAMPLE
V.
thlnetic:
AInortiza
Dictionaries
SMALLTALK
tion
of
Loans
for
Storage
CLASS
DEFINITIONS
...............•.••...•......•.....••••.......•..•........•
and
Retrieval.
............••.....•.....•.•••.....
...•...•••....•.................•..•••..•........•........•..•..•......•••••....••......•....•••.•....•
Class
TIle
Class
Dictionaries
Rectangle
of
Areas
.......••••..•...•....••••....•.......•............•.•....•..••.••.•.•.....
and
Points
.....................•..•......•...••...•......•..•
...........••••..........................•........•.•....•......•....•......•••.......•.••...•••.•..•.•..•.•
Commallder
Classes
Scheduling
Looplcss
Sal11ple
for
Sirnpllla
A
Text
Buil(ling
Simple
Turtle
for
Repetition
Methods:
Scl1eduling
Editor
........................................•....•.......................•....••.....
Moclels
Style
Silnulation
I-Iospital
.............................................................................
and
Alternate
sched
••.....•••.........••......••..•...••.••..••..•..•...•....••••.•••..•...
and
window
Paths
................................
......................................
.......................................................................
............•.•..•.•.•....•..........•...••.....•.••••.....•..
Simulation
........................................................
.........••.•••.....•.......••..•...••......•....•......................•.............••.................••••....
84
87
90
92
94
96
96
98
102
107
110
117
117
121
124
v

PREPARING A BASIC SMALLTALK DISK
There
save
programming
some
in
exists a disk
on
disk
Small
the
manual:
boxes,
windowfns,
Not
included
These
can
be
on
the
various
following
(included)
animationget
finditget.cm
finditvget.cm
musicget.cm
editfontget.cm
The
format
@<filename>@
To
the
update
archival
your
pack
that
space,
talk
fontfns,
only
system
font
including
files. Also
nwindowfns,
xydic,
are
all
retrieved
frameworks
command
the
the
xfer,
files
onto
.em
for
executing a command
<return>
files,
either
file
system,
retrieve
contains
main
files
the
windowing
included
simpulafns,
xyfns,
your
from
use a Basic
xplot
needed
disk
a disk
files:
a file
the
have.
are
to
run
either
that
file is
Small
named
Basic
Small
been
functions,
files
that
turtlefns,
the
music,
(1)
by
already
talk
disk
talk
System
placed
transferring
on
an
editing
contain
animation,
contains
for
transferring
this
the
the
them,
as
disk.
facility
sampl'3
findit,
files
or
described
These
and
class
and
noted
(2)
by
files, or,
in
this
include
printing
definitions
editfont
in
the
documentation
executing
if
you
have
manual.
the
Smalltalk
routines,
presented
frameworks.
one
of
access
To
and
the
to
If
you
listed
<
smalltalk>smallmanual.cm
execute
above.
it
as a command
file,
your
disk
will
be
updated
with
the
Basic
Smalltalk
disk
files
vi

ORIENTATION
AND
OVERVIEW
Page
1
Chapter
I.
INFORMAL ORIENTATION
Introduction
This
manual
As
such,
it
also
Chapter I demonstrates
includes
Chapter
retrieving
class
definitions,
(the
class
turtle.
attention
class
dispframe,
and a "paint
Chapter
These
classes
Many
classes
names,
all
of
examples
editing
reading
is
intended
it
employs a tutorial
maintains a somewhat
the
use
of
II
continues
Smalltalk
beginning
polygon),
Included
is
III
include
and
arithmetic,
these
that
definitions,
input
in
paid
to
and
brush".
goes
deeper
the
instances;
have
basic
use
devices.
for
some
display
this
programs.
and
this
chapter
the
idea
presents a number
into
method
One
already
information
classes
these
is
basic
saving
use
by
style
informal
of
the
graphics,
introduction
It
then
with
the
continuing
is
of
message
the
basic
of
evaluation
part
describes
been
built
storage
given
in
classes.
and
retrieving
TO
THE
those
persons
that
directs
methods
dialog windows,
by
begins
class
with
definition
of ways
concepts
of messages,
subsequent
for
the
methods,
Chapter
Chapter
files
immediate
dialog
used
demonstrating
specific
box,
then
methods
of
sending
to
user's
IV;
IV
of
SMALLTALK
with
on-line
about
for
and
expanding a box-shape
for
the
set
and
receiving.
place
from
message
presentations
convenience.
text
display,
Chapter V then
also
describes
information,
access
experimentation
expected
interacting
font
editing
methods
instruction
communicating
of
special
text
on
the
which
everything
sending
These
and
utilities
viewing
SYSTEM
to
the
Xerox
with a Small
results
windows.
for
on
symbols
Finally,
screen
of
graphic
presents a number
of
with
the
creating,
the
development
into
with
used
this
and
else
and
receiving,
basic
class
include
control.
already
definitions,
such
Smalltalk
any
instances
chapter
to
in
definitions.
the
provided
Interim
editing,
in
sketch
Small
and
various
The
testing
Dynabook.
talk
experimentation.
system;
saving
of
Small
regular
of
the
Smalltalkj
describes
with a "pen"
talk
the
notion
classes
definitions
of
interesting
the
values,
system;
and
talk
polygon
class
some
the
is
built.
for
user
for
and
it
of
of
To
Get
Place
your
appears
the
information
the
@ is
rectangle
If
back
Interim
@s@
typed
A
you
are
(yellow
Small
@cs@
Started
Smalltalk
light),
of
your
having
Dynabook
<return>
by
holding
(window)
talk
on a color
<return>
disk
press
keyboard).
to
do
operating
down
will
appear
Window
machine
in
with
both
the
machine,
the
"bootstrap"
The
the
system.
the
with
(your
screen
particular
Type:
key
marked
text
in
screen
press
"run"
button
will go
it
background
(the
machine
'SHIFT'
on
the
disk
little
one
blank
for a second
configuration
and
the
has
color
drive,
located
you
'2'
rather
key.
than
and
near
and
are
There
when
where
then
using.
will
white),
the
show
You
be a
you
"ready"
the
are
should
wires
you
talking
flash
light
enter
some
and
type:
to
a

ORIENTATION
The
Mouse
The
little
rectangular
a
mouse.
response
where
In
In
case
of
the
try
is,
press
last
Move
it
to
it.
This
it
is. A
little
Case
to
resort,
of
Disaster
of
any
disaster,
keyboard).
wakeup a "hiding"
the
key
marked
press
the
AND OVERVIEW
object
with
three
around
bit
Try
.while
is
how we
further
first
push
to
put
the
window.
'ESC'
"bootstrap"
watching
point
on
we
the
mouse
while
button
to
will
If
holding
buttons
the
objects
explain
(escape)
cursor
that
doesn't
down
again
that
usually
screen.
on
key
in a displayed
and
the
how
you
(marked
help,
the
keys
go
through
An
screen.
then
sits
arrow
can
ask
'ESC'
window
try
marked
the
to
the
(mouse
Smalltalk
the
mouse
and
located
or,
typing
'SHIFT'
above
right
of
the
keyboard
cursor)
constantly
by
moving
the
in
will
same
the
the
be
"asks"
questions.
upper
mouse
(shift>(ctrl>(escape>.
and
'CTRL'.
sequence.
Finally,
Page
is
called
moving
the
mouse
left
corner
around,
in
That
as
2
a
Talking
If
you
are
the
bottom
message.
so
that
A
small,
test
this,
3+4
The
I
Small
talk
'*'
is
how
355.01113
The
result
Helpful
Small
talk
when
you
cursor
window.
When
yourself
outside
you
To
Small
on
one
of
our
of
the
screen. A white
Move
the
cursor
the
cursor
flashing
type:
travels
image
I
(do
it>
character
that
this
is
the
we
express
the
I
shows a well-known
Notes
will
only
listen
arc
out
of
a window will
of
the
Now
move
the
have
learned
that
the
characters
talk
color
into
into
of
the
is
message
sign
to
window
cursor
to
create
will
machines
rectangle
the
window.
the
rectangular
Interim
marked
for
you
and
.'LF'
you
mUltiplication
number
through
be
typing
into
the
mUltiple
indeed
then
If
Dynabook
on
really
want
and
the
a window
saved
3+4.
window.
windows,
appear
move
the
mouse
(a
Smalltalk
on a black-and-white
frame
at
will
the
upper
it
to
in
Small
accuracy
when
until
you
You
will
The
you
only
in
the
so
dialog
the
bottom
appear--this
right
do.
Now
talk.
Try:
of
Smalltalk's
the
place
the
not
see
characters
might
window
that
the
window)
machine,
of
the
means
of
your
try
the
cursor
cursor
the
'3+4'
repeat
containing
cursor
will
screen.
Smalltalk
keyboard.
following:
fractional
is
in
it.
in
a window.
characters
will
this
experiment
the
travels
appear.
simply
It
arithmetic.
Any
appear
appear
cursor.
all
the
It
contains
move
the
is
listening.
is
used
characters
Try
taking
in
the
in
the
to
prove
way
off
mouse
To
to
tell
typed
the
dialog
window.
to
a
Once
wakes
Small
you
up
talk
start
again.
will
typing
So,
continue
characters
if
you
inadvertently
to
listen
in
a window,
in
that
Small
move
window.
the
talk
will
cursor
wait
for
out
of a window
you
to
type!
while
before
you
any
are
window
typing,

ORIENTATION
AND
OVERVIEW
Page
3
Deleting
your
If
it»,
To
(backspacing)
keyboard.
you
inadvertantly
a diagnosis
see
this,
mumble
make
windo~
try
typing a symbol
I
A diagnosis window will
not
flash.
context.
To
Once
a diagnosis window
get
back
to
done!
or
the
shorter
form:
<ctrl> D
typed
by
striking
the
'0'
Try A Turtle
Turtles
where
are
they
little
have
beasts
been.
of
unwanted
an
error
will
appear
appear.
your
previous
key
while
which
Smalltalk
characters
of
with a message
for
which
Note
that
appears,
context,
holding
crawl
around
line
drawings
some
Small
down
the
on
is
kind,
talk
prompt
it
either
the
the
are
done
which
that,
does
listens
key
screen
done
with
is
at
not
character
to
type:
marked
with
the
'BS'
then
sent
this
point,
yet
have a meaning,
(the
you
until
'CTRL'.
and
can
leave a variable
turtles.
key
to
will
Interim
located
Small
probably
you
return
on
the
talk
by
be
such
as:
Dynabook
to
width
upper
right
saying ! «do
obscure.
image)
your
does
previous
tracing
of
of
Small
talk
One, ®
marked
Small
As
(such
talk
with
(called
'SHIFT'
all
as
reasonable
® go
® is
®
turn
To
redo a previous
redo
where
11.
is
are.
If
you
Small
talk
statement,
redo!
can
have
many
"smiley"),
and
than
it
does
Small
talk
"go forward
questions
100!
1.!
90
go
lOa!
statement,
11.
!
the
number
type: redo
and
another
simply
type
turtles.
has
already
the
'2'
key
in
the
Interim
objects, ® can
some
number
(such
as
"what
type:
of
transactions
I!
at
this
line
will
be
the
equivalent
Each
is
created
been
created
(Le.,
the @ sign
Dynabook
receive a variety
of
steps",
kind
of
thing
(visible
point,
drawn
the ® turn
on
statement:
as
for you.
which
operating
"turn
are
A
vertical
? is
'SlIIFT'
Is
the
Did
images
the
display
an
instance
It
has a different
system).
of
messages
some
you?",
what
typed
answer
of
"where
line
holding
and
'6'
happened
the
Interim
90
go
screen.
of a group
is'
typed
asking
number
are
should
appear.
down
both
keys.
(turtle)
reasonable?
make
Dynabook)
lOa! message
If
you
by
holding
printing
it
of
degrees",
you").
the
sense?
want
or
to
do
Type:
should
class
back
to
we
call
down
both
representation
"turtlelike"
...
),
and
from
where
be
re-sent
redo
the
previous
turtle.
the
key
things
answer
you
in
to

ORIENTATION
Try
® erase home!
do
4
(®
go 100
® erase home.
for
i
~
1 to
The
text
line
change
the
message
in
the
practice
the
period
message
text
to
to
home.
window.
include
signifies
Smalltalk.
200
periods
AND
turn
do
(@
in
the
This
The
the
OVERVIEW
90)
!
go
i*2
turn
above
transaction
"carriage
period
when
end
return"
is a delimiter,
stringing
of
the
89)!
does
together
message,
Clears
turtle
and
Will
To
is
obtained
not
affect
signifying
you
still
the
screen,
to
its
center
points
the
turtle
make a
square
get a "squiral".
by
pushing
anything
the
end
several
need
complete
to
brings
the
position,
upward
the
key
except
of a message.
messages.
type
! <do
marked
the
appearance
it>
It
Note
to
actually
is
'RETURN'
of
the
generally
that,
although
send
Page 4
after
text
good
the
Notice
The
hence
and
of
up)
You
the
counter
is
Layout
that,
window
erased
then
the
turtle
whenever
have
number
used
to
back
also
(in
help
of
has
of
the
as a result
much
drawing
The x direction
direction
original
runs
window)
Small
talk
0,0
of
not
been
destroyed.
of
the
window
into
the
remembered
that
overlaps
the
text
scrolls.
just
used
two
times a message
above
example,
determine
the
runs
from
is
display
the
Smalltalk
from
top
to
bottom.
680.
screen
X
------)
the
Small
distance
left
above
messages,
Merely,
information.
window
the
talk
iteration
should
the
counter
the
Screen
to
right.
The
512,0
area,
window.
be
evaluated.
is
turtle
The
left
top
margin
the
®'s
drawing
None
refreshing
Any
methods:
i)
can
will
hand
is
black
of
that
turtle
In
be
used
travel).
margin
0,
the
frame
area
information
the
lines
do
and
the
more
as
part
is 0,
bottom
around
overlapped
window
for.
inside
display.
the
Each
general
of
the
the
right
one
(at
the
window
with
is
lost.
window
is a
method
message
the
the
hand
lower
has
window
Move
This
erases
will
method
for,
(in
one
boundary
disappeared.
area,
the
cursor
any
scroll
for
counting
the
iteration
the
example,
is
512.
and
off
part
(move
The
of
the
i
;y
Now
0,680
say
to
the
® erase!
® goto
100
------------
turtle:
100!
y
v
512,680
Is a
line
drawn
to
the
top
left
quadrant?

ORIENTATION
Type
mx.
Then,
before
!
AND
typing
OVERVIEW
the
!,
place
the
cursor
somewhere
in
the
screen
and
type:
Page
5
Similarly,
my
I
Smalltalk
coordinates
rID
goto
and a line
simple
drawing
repeat
Move
the
repeat
marked
window.
Try
forever).
'ESC'
rID's
The
'5
is
typed
A
more
involved
width,
and
try
should
of
the
mx
should
(@
mouse
in
width
by
erasure.
send
mouse
my!
be
drawn
program
goto
mx
and a trail
To
escape
the
upper
~
3.
repeat
striking
drawing
More
you
cursor.
to
can
be
my)!
will
from
left
(@
the
program
about
back
Now
the
written
be
the
hand
goto
key
might
drawing
reasonable
type:
cursor
by
left
behind.
loop
corner
mx
my)!
marked'S'
use
programs
numbers
position.
saying:
You
and
to
of
while
the
buttons
You
are
get
your
holding
later.
for
have
in
an
Smalltalk
keyboard
down
on
the
m(ouse)x
hooked
"infinite"
to
listen
and
the
key
mouse
and
up
loop
move
marked
to
control
the
to
you
the
m(ouse)y,
mouse
(the
®
again,
cursor
(CTRL).
the
turtle's
to
goto
press
back
the
the
mx
display
turtle.
my
the
into
ink
A
will
key
the
color,
Dialog
All
communication
editor
for
kind
of
painting
editor
allows
Every
window
particular
pictures,
retrieval
For
example:
a.
Move.
the
top
button.
button
window
b.
window
the
method
in
corner.
Now
will
physical
for
point
Windo,vs
that
object
and
the
character
can
kind
of
text)
is a
and
editing.
Move
the
The
order
to
the
reappear
display
pushing
to a Smalltalk
(you
have
drawing
defining
be
moved,
window
with
document
cursor
window
find
cursor
screen;
them
the
somewhere
in
the
out
into
should
actual
new
however,
of
object
just
been
aid;
the
dots
stretched,
which
which
can
the
upper
go
corner.
else
position.
the
way
using
editor
to
and
you
be
blank.
The
on
the
until
is
be
left
The
other
done
through
a
dialog
for
easily
deleted
are
dealing. A collection
automatically
hand
You
tip
of
the
screen
upper
parts
needed
window).
a
paragraph
changed;
from
corner
may
have
the
cursor
and
left
of
again.
the
archived
corner
the
windows
The
of
and
so
screen.
of
the
to
playa
(the
push
of
window
which
editor
text
handles
forth.
Other
of
related
in
many
window
little
upper
the
top
the
window
can
contain
different
you
left
button
be
slid
for
a
picture
characters;
abilities
windows
are
in
while
corner)
briefly
can
off
the
most
depend
ways
and
holding
must
not
be
the
display
useful
object
(containing
press
again.
the
on
for
down
down
be
in
forced
is
font
the
later
the
the
The
off
as
a
a

ORIENTATION
c.
Grow.
due
The
position
wide
d.
Create.
existing
will
e.
Position
f.
Delete.
dialog
to
the
next
will
or
32
dialog
appear
window.
Now
move
previous
button
coincide
units
A
new
window
in
the
the
cursor
Any
high.
dialog
For
AND
move.
push
dialog
upper
obvious
OVERVIEW
into
the
do
another
will
change
with
the
window
(pointing
left
portion
inside
the
window
reasons. a single
lower
cursor.
new
can
right
move
the
will
the
of
window
be
corner
further
boundaries
Try
it.
be
created
cursor
the
display
deleted
and
and
remaining
in a similar
to
the
of
the
You
can
for
pressing
screen.
try
typing
by
grabbing
manner.
left
to
window so
not
grow
you
by
the
3+4!
its
dialog
get
the
the
grabbing
top
mouse
.
top
right
window
(If
right
that
window
corner.
can
the
corner
hand
the
the
lower
b1\tton).
not
new
smaller
Try
be
deleted.
is
side
lower
left
The
it
off
the
visible
right
than
corner
new
with
Page
screen
again.)
corner
32
units
of
window
the
new
6
an
Try
overlapping
of
all
other
Each
new
each
window
dialog
cursor
cursor
about
Small
A
First
Every
with
of
Every
example,
lines
replies)
entity
each
objects
object
on
I
Move
I
I
I
Create
windows.
dialog
window
could
blink
location
talk,
Note
other
to
receive
belongs
is
an
the
display
for
every
windows.
as
it
is
is
you
in
Small
by
object.
window
is
created,
to
have a new
on
and
the
place
might
on
Small
talk's
sending
messages
to a class
It
screen.
object
which
The
window
appears
the
off,
waiting
to
put
make
talk
world
and
receiving
and
(a
is a
member
The
belongs
Delete
Grow
that
in
the
windows
window
for
the
this
change
Classes
is
called
produce
method
of
class
handles
to
sees
upper
will
appear
you
new
dialog
to
an
object.
messages.
replies.
for
grouping
the
class
it.
the
mouse
left
portion
pile
on
top
at a location
to
press a mouse
window.
your
personal
Objects
Each
example
together
turtle.
all
communication
cursor
of
of
Later
Small
can
All
wakes
the
display
one
another.
pointed
button
on,
talk
remember
we
present
objects
members
(receiving
up
to
by
to
after
system.
that
of
and
displays
screen.
Another
the
mouse
indicate
you
have
things
demonstrates
do
similar
this
class
messages
itself
Unless
way
to
cursor.
that
the
learned
and
communicate
things).
are
able
and
on
you
move
define
The
present
more
the
ability
®,
to
draw
producing
top
a
for
We
have
pointing
the
message
class,
capturing
editor
or
for
just
been
with
the
by
deleting
and
editing
designing
looking
mouse
moving
(erasing
display
at
cursor
to a new
itself
Smalltalk
characters.
members
and
screen
from
messages.
of
pressing a mouse
location,
the
the
class
screen).
The
next
window.
button.
changing
The
example
Messages
Each
its
size,
objects
is a
are
sent
member
creating a new
are
font
of
dialog
window
the
windows,
to
class
member
which
a
window
responds
capable
contains
of
by
to
the
of
an

ORIENTATION
AND
OVERVIEW
Page
7
Font
Type
fUin
while.
You
white
design
mouse
cursor
in
that
A
newly
font
is
created
Editing
is
the
The
now
have
dots.
of
the
cursor
to a dialog
dialog
created
window
only
Windows
filin
'fontfns'l
Small
talk
display
routines
These
display
in
a
font
window,
window.
fontchar!
window
can
be
by
typing
I
move
I
I
I
change
I
baseline
method
screen
for
windows
characters)
window,
Type
appears
moved,
the
for
is
purposely
creating
contain
you
can
deleted,
message
reading
turned
windows
magnified
can
be
you
can
immediately
in
the
upper
and
fontchar.
delete
change
width
messages
off
in
described
draw
in a character
left
its
size
stored
(becomes
which
views
as a matrix
view
font
corner
changed.
editing
of
display
changes
of
on a disk
blank)
means
characters.
of
font
the
display
Unlike
to
speed
drawing
black
of
your
within
dialog
file.
Reading
up
the
reading
in a matrix
Any
character
and
white
own
choosing.
the
!;!ontext
screen.
Like
windows, a new
the
dots.
of
text
dialog
file
takes
process.
of
black
font
Using
Moving
displayed
windows,
font
window
a
and
(the
the
the
a
Four
actions
button.
1.
Move
the
a
new
position
2.
Delete
3.
Change
adjustment,
lowering
line;
boundaries
change
4.
right
and
5.
in
through
black
location
dots
the
no
only
Change
corner
may
not
Drawing
the
window
the
dots
in
as
long
are
window.
the
the
up
baseline
lower
will
appears
the
and
exceed
black
matrix
appear
the
as
taken
on
the
window.
baseline
or
down,
limit
cause
in
width
then
16
and
and
pressing
dots
in
window
the
mouse
by
pointing
Point
display
Point
of
creates
exists
Small
the
of
the
to
the
dots,
white
as
any
area
and
button
to
the
screen
to
the
of
the
subscripts.
with
talk
to
printed
window
new
so
it
dots.
the
bottom
long
as
con
pressing
to
one
upper
and
press
the
upper
character.
character's
the
exception
crash.
text.
(and,
right
margin.
may
not
Black
mouse
the
mouse
taining
the
is
pressed;
of
the
left
right
Point
The
Note
Move
appear
dots
button
the
middle
white
corners
corner
the
top
corner
to
baseline.
upper
thn t an
that
the
the
cursor
thereby,
The
exactly
are
button.
black
mouse
dots
of
and
mouse
and
the
limit
attempt
font
into
the
width
at
painted
The
is
pressed.
lines.
button.
appear
a
font
press
button.
press
lower
Raising
is
the
window
the
width
is
rounded
the
into
drawing
White
when
window
the
top
the
left
the
baseline
to
dialog
of
the
mouse
the
technique
As
soon
dots
White
the
and
mouse
top
mouse
corner
print
appearance
matrix
and
baseline
of
the
outside
window
matrix).
to a multiple
cursor's
by
is
as
the
are
painted
lines
are
button
pressing
button.
button.
then
creates
previous
the
docs
to
see
Point
of
arrow
pointing
to
scratch
button
by
written
is
released.
the
top
Then
to
the
superscripts;
text
display
not
change;
the
change.
to
the
16
display
head.
to a location
black
is
released,
pointing
through
mouse
point
relative
display
screen
the
lower
bits
lines
the
to
the
to
a

ORIENTATION
6.
New
characters.
period,
keyboard,
'.'.
the
To
desired
change
AND
When
the
character.
OVERVIEW
the
window
character,
place
is
first
the
created,
mouse
the
cursor
character
inside
available
the
window
for
and
editing
type,
Page
is
on
8
the
the
Once a new
where
(filename>
The
font
of
To
read a saved
For
example,
The
font
of
If
you
have
Other
Small
font
filfont
filfont
the
dialog
font,
filfont
filfont
the
dialog
stB.al
made
fillont
talk
has
been
<filename>
is
some
'myfont'
window
type
<filename>
'myfont'
window
changes
'stB.al'
fonts
include
designed,
out!
name
delimited
out!
in
which
in
!
in
!
you
but
would
in!
st6.al
it
is
saved
you
received
like
to
and
stlO.al;
by
single
are
when
return
on a disk
quote
currently
you
first
to
the
each
file
can
by
typing
marks.
typing
started
original
be
retrieved
For
example,
is
the
working
(default)
one
from
that
will
is
stored
Smalltalk
the
archival
be
saved.
on a filed
font,
type
file
named
system.
The
font
of
the
<filename>. rl'he
typing.
order
to
dialog
font
to
replace
windows
window
Note
have
one
however,
two
of
(A
will
fontchar
Recall
The
copy of
Results
the
which
The
now,
Warning:
character
used
that
class
the
of
original
window
use
of
assume
with
the's
fontchar,
value
editing
font
is
the
name
their
some
used
to
this
font
dialog
font
font
the
dialog
and
appear
font
is
typed
upon
following
the
new
window
used
for
disp
use
for
fonts
mark
editing
window
you
edit
that
each
windows
window's
B)
and
in
both A and
disp's
by
stiking
receiving
the
font
will show
typing
and
the
have
the
black
system.
in
is
editing
suppose
font!
message
window
the
the
above
no
definition
which
the
one
dialog
the
the
window
separate
font
you
B.
key
message
font
will
only
in
filfont
message's
redefinition
t.
dots.
Any
you
are
currently
currently
is
created
fonts
with a copy
type
fontchar!
Now
type
marked'S'
font,
(in
this
then
show
B.
Choice
message.
are
described
of a dialog
for
the
font
without
belonging
for
each
of
itself.
in
in
window
while
will
replace
case,
in A and
of
which
in
character
this
typing
with
with a copy
window
to
the
references
of
two
For
window
A
holding
the
not
fonts
more
font.
whose
character
will
in
detail
change
dialog
dialog
example,
A.
Results
down
the
font
for
of
B;
moreover,
are
saved
in
Ascii
properly
to
the
window
to
the
identical
windows,
suppose
of
key
marked
dialog
the
font
will
subsequent
code
is 31.
defined
font
saved
in
which
it
editing
window A with
possessed
results
depend
you
font.
is
necessary
there
are
the
(CTRL>.
of
solely
sections.
This
can
single
by
editing
is
not
on
are
In
two
a
A).
on
For
the
be

WRITING
SMALLTALK
PROGRAMS
Page
9
Chapter
Simple
To
hand
(The
II. WRITING SMALLTALK PROGRAMS
Manipulation
an
object
@='
is
typed
d!
The
meaning
Each
object
we
might
@='d
Thc
new
In
these
indicates a desire
Previous
make
that
to
give a
objects.
(or
in
Small
say
~
turtle!
meaning
examplcs,
turtle
definition a Small
name
So we
'd'
the
as
<shift> ' ).
value)
talk
(or
value)
we
to
give
examples
to
the
need
to
of a Simple
meaning
of d (which
can
use
the
showed how we
actions
say
something
'3'
If
you
only
have
of d (which
the
symbol
name a meaning.
talk
object,
which
Program
in
Smalltalk,
now say:
is a
number,
one
meaning.
is a turtle)
GT
to
can
get
use
it,
cause a square
similar
to
we
3)
will
will
indicate
a
turtle
change
what
say:
be
returned.
To
change
be
returned.
that a literal
to
draw a square.
it,
save
it,
to
be
drawn.
was
just
said
the
and
to
meaning
name
Now
retrieve
In
Smalltalk,
d.
Type:
of
the
follows.
we
need
it.
To
object
The
to
do
this
actions
named
arrow,
be
able
we
are
'd',
+-,
to
need
also
to
square
(do
This
will
cause
symbol
are
Erase
to
enclosed
the
screen
® erase
Then
say:
square!
The
stored
turtle
to
go to
to cl
Now
only 3 characters
el!
rather
than
4
(@
(rather
in
home
actions
home
(®
13.
go
100
turn
Small
talk
than
the
parentheses.
and
bring
!
will
be
can
also
erase
home)
have
90))
to
give
hand
~)
the
turtle
invoked.
be
abbreviated:
!
to
be
!
the
indicates
back
The
typed:
actions
to
commonly
do
the
home
4{®
desire
position
used
go
100
to
actions
give a
by
saying:
turn
of
90)
the
name
clearing
to
name
some
the
square.
actions;
screen
and
Here,
the
actions
telling
the
the

WRITING
Now
type:
dels!
A
list
of
the
contains
the
SMALLTALK PROGRAMS
names
names
square
of
and
user-defined
cl
should
be
programs.
typed
back
at
you.
dels
is a kind
of
"bushel
basket"
Page
which
10
How
In
An
The 0 stands
to
any
dialog
edit
editing
do 4 ()
Edit
square !
window
® go
Actual
see
top
to
bottom
You
parentheses
the
message
button
right,
buttons;
should
on
rather
see
® go
Place
the
cursor
backed
up
to
Your
window,
for a parenthesized
100
turn
within
the
than
the
the
100
tu.rn
on
the
next
Definition
type:
with a command
90
never
show
the
mouse.
vertically,
left
button
message
90
the
word
higher
menu
message
in
the
parentheses,
(Note,
as:
some
top
corresponds
'Leave'
level
of
will
appear.
which
editor,
to
in
parentheses.
only
point
the
versions
bottom.
to
the
menu
The
in
this
the
cursor
of
the
Henceforth,
the
top
and
"method"
case
contains:
marker
at
the
mouse
button.)
press
()
indicating
word
have
we
will
the
top
of
square is
'Enter'
buttons
refer
mouse
levels
in
the
laid
only
button.
shown
of
parentheses.
menu
out
horizontally,
to
top,
as:
and
middle,
You
push
have
To
the
left
and
now
We
will
object
pointing
button).
Grab
Now
color
Grab
more
will
expected.
You
(word,
'Enter'
let's
to
'100'.
elements
also
50!
will
® go
use
at
is
change
show
The
reverse
Type:
now
50
the
word
icon)
really
again.
the
that
top
beginning
color
see:
turn
"grab"
and
pushing a button
the
one
we
100
to
a
the
selection
half
will
at
'100'.
and a prompting
90
to
stand
mean.
50
in
is
understood.
reverse
for
the
on
(Unless
the
definition
color.
This
We
only
want
Interim-Dynabook
compound
the
mouse
specifically
of square.
means
one
element,
operation
to
tell
stated
Grab
that
'Replace'
image
the
to
the
'Replace'.
so
grab
will
of
positioning
system
contrary,
expects
'100'
appear,
that
the
push
It
will
reverse
you
again.
indicating
the
to
The
cursor
object
the
top
its
replace
bottom
that
on
we
mouse
display
one
typing
an
are
or
half
is

WRITING SMALLTALK
Now
grab
'Exit'
to
terminate
context.
and
A
square!
one
Note
Say:
of size
on
Editing
'50'
will
be
drawn.
PROGRAMS
the
editing
So
the
"meaning"
context.
You
(or
"actions")
will
be
returned
of square
to
has
the
been
previous
changed.
Page
11
Smalltalk
There
Once
dialog window. Also
window,
do so we
We
are a number
menu
word,
or
pointing
for
already
lose
'Add',
you
any
the
'Insert',
received
have
previous
the
Generalizing
Now
suppose
can
square
must
now
First
say:
have
cursor
'Leave'
outside
nor
the
selected
edits.
the
we would
give square a
150
!
change
show square !
to
remind
yourself
what
to square
(do
4
(@
go
50
of
ways to
not
completed
'Exit'.
Interim
the
Pressing
note
and
'Enter'
Definition
like
"message"
the
definition
the
turn.
90))
terminate
the
the
editing
If
you do
DynaboQk
phrase, a replace
the
that
if
commands
to
make
current
an
selection
window
not
prompt
'ESC'
there
is
of
Square
square
saying
of
square so
definition
editing
and
want
command
key
more
expect
more
what
of
sequence
of a
phrase
pushing
to
complete
character,
takes
than
you
to
general,
the
size
that
it
square is.
to
the
just
cannot
you
one
parentheses
point
so
should
can
We
before
replace
top
an
type ! (i.e.,
be
terminated
out
of
at
the
that
be
receive
see:
completion.
or
mouse
add
or
the
edit
marker
appropriate
it
will
this
time,
the
message
delete,
button.
insert
unless
window
draw
such
If
you
This
command,
insert
displayed
marker.
squares
as:
and
you
grab a wrong
can
terminate
docs
or
add
you
are
and
back
in
of
any
act
accordingly.
not
work
but
have
nothing).
willing
to
the
the
edit
size.
by
to
To
It's
clear
definition
Suppose
the
give
number
to square
Now we
request
So we
want
that
(having
there
is a way
particular
will be.
(do
4
(©
go
just
need
to
"receive
to
we
want
4 sides
to
value a "name"
Let's
call
size
turn
to
get
the
value
add
to do
something
and
turning
receive a value
it
size.
90))
square
of a
90
in
order
Looking
to
receive
message"
with
degrees)
from
the
to
talk
above,
the
is
expressed
the
describe
message.
about
we
see
value
place
where
squares
The
it
since
that
size
of a
message
by a colon
50
in
general.
value
we
don't
should
and
is.
Everything
needs
know
replace
call
to
be
beforehand
the
it
size.
some
50
In
else
number.
:
Small
about
what
talk,
the
We
the
the

WRITING
SMALLTALK
PROGRAMS
Page
12
~size
to
the
beginning
edit
Grab
'Insert',
cV-size
Careful--the
message
inserts
'ro
and
before
replace
® go
Grab
'Replace'.
and
ending
size!
Grab
'Exit'.
show
of-
:.
square!
grab
of-
:.!
period
then
the
the
50,
50
tu.rn
You
of a
phrase
You
square!
of
square.
'do',
is
invoking
selected
grab
90
want
are
no
Say:
type:
necessary
an
element.
'Enter'.
to
replace
to
be
replaced
longer
here.
action
You
talking
It
helps
for
should
the
'50'
by
new
to
the
to
separate,
producing a response.
see
so
grab
'50'
text).
editor.
Now
Type:
and
type
in
one's
grab
the
mind,
Note
'50'
new
again
text
the
sequence
that
the
(indicating
of
'Insert'
the
receiving
command
beginning
a
to
see
what
to
(G?size
Then
try
square
square
and
so
on.
The
colon
meaning
actions
taken
square 150+20!
Smalltalk
the
next
object
size
The
(in
is
the
definition
you've
done.
square
of-
:.
do
4
(®
go size
sending
turn
several
ISO!
10!
expresses a request
of
the
next
object
by
the
next
runs
the
definition
object,
the
number
this
case,
the
sum
17
O.
of square is obviously
It
should
90))
messages
to
(for
object.
of
150.
number
look
to
draw
Small
example,
For
square.
This
20),
working
like:
different
talk
to
the
example,
When
number
and
performs
fetch
number
try
it
but
squares:
the
sees
sees
the
the
is a bit
next
10).
the
colon
plus
addition.
untidy.
value
in
But
the
in
(r:Jrsize ~ :.),
sign
(+),
The
To
see
the
value
fetches
value
why,
message.
can
also
Small
the
returned
type:
The
be
talk
value
as
value
the
result
"activates"
of
the
the
value
is
next
the
of
of
size!

WRITING
The
value
of
for
the
size
uses
it.
To
after
the
name
SMALLTALK
the
last
size
of
do
square
this
we
square
belongs
only
in
PROGRAMS
you
gave
to
everyone.
need
the
"title"
square will
to
tell
square
part
of
It
is
the
be
returned.
much
that
size
definition.
better
This
for
belongs
Say:
shows
size
to
to
it
that
belong
by
putting
the
"name"
only
to
the
of
the
name
the
object
size
Page
13
message
which
right
edit square
square's
you
were
title
to
size!
Grab
'Exit'.
show
square!
You
should
see:
to square size
(eg-.
do
(@
Later,
make
to
when
our
exhibit,
story
in a general
square < number> 1
means
might
be
the
object
title!
line
'Enter'
Type:
size ~ :.
4
go size
more
more
will
be
(),
you
turn
of
the
compact
way,
square
shown
would
90))
Small
and
what
expects
as
well
see
talk
clear.
has
anything
as
the
definition
system
For
to
be
0,
the
marker
itself.
has
been
explained,
example, a short
said
to
get
results:
which
evaluates
representing
Instead,
we
will
way
to
to a number
the
gra-b
'Insert',
adopt
talk
about
as a message.
body
of
grab
some
this
the
program
definition.
0,
type:
abbreviations
would
An
example
If
to
be
square
Here,
the
example
floating
number
fetching a value
evaluated
expression,
second,
10
or
20
Fixing
You
can
edit a named
fix
30.4+(
colon
demonstrates
point
number
for
the
which,
the
and
the
- 5 +
21
- 2 *
3!
Your
edit
the
definition
n !
111.
7*65.
in
(~size
the
left-to-right
30.4
augend.
from
in
multiplication
addition
the
turn,
last.
However,
sees
Dialog
command
(described
789
~
:.)
which,
message.
the
is
Try
lines
)/99!
fetches
in
turn,
the
division
carried
response
response
(or
statements)
in
the
the
result
method
arithmetic
As a result,
for
sees
sign
out
first
is
3,
is
14,
previous
the
not
of
the
expression
receiving
plus·
is
the
and
(because
7
not
54
in
the
section).
messages;
sign
right
associative.
floating
requests a divisor
of
dialog
To
30.4+(111.7*65.789)/99.
that
and
attempts
point
the
explicit
window
fix a previous
is,
Small
to
receive a floating
The
augend
number
(the
99.).
parentheses),
in
the
same
command
talk
is
(111.7
Hence,
manner
line,
first
sees
obtained
*65.789)
in
the
division
that
type:
This
the
point
by
is
this
you

WRITING
where
n is
are.
An
editing
terminate
Small
talk.
SMALLTALK
the
number
window
the
The
with a command
editing
line
context.
in
of
transactions
the
dialog
PROGRAMS
(visible
menu
will
This
causes
window will
the
images
appear.
edited
not
be
of
the
line
altered.
Interim
Arter
to
making
be
sent
Dynabook)
changes,
and
evaluated
back
from
you
as a message
grab
Page
where
'Exit'
14
you
to
to
Saving
Type:
and
defs!
again.
square
filout
such
as:
filout
The
screen
To
test
whether
square
This
will
generate
a
"clean"
Diagnosis
The
complaint
(1)
to
provide
arrow
Jo+,
to
Retrieving
and
(some
'mysquare'!
will
go
you
100!
version
Window
is
the
the
object
cl
will
name
blank
actually
a
diagnosis
of
Small
stated
name
Programs
still
be
in
single quotes>!
for a second.
saved
window
talk,
one
in
a
diagnosis
of
the
program
causing
the
there.
them,
in
problem.
To
save
go
with
which
window.
in
everything
through
the
complaint
square
which
the
has
Small
the
in
defs,
"To
get
that
not
been
talk
attempts
complaint
type:
started"
"square
defined.
occurred,
to
has
state
sequence
no
value".
the
and
(2)
again.
complaint
to
Then
We
point,
try:
are
now
and
then
with a big
in
In
the
are
within
still
at
Small
talk.
context;
higher
cause
of
c !
you
see
Type
done!
to
get
context
the
the
"top
Each
after
level
of
complaint.
the
next
or
out
of
of
the
context
level"
attempt
completing
context.
higher
(ctrl> D
the
diagnosis
diagnosis
of
the
of
It
Each
level
window, you
object
Smalltalk;
by
one
the
evaluation,
is possible
time
you
of
context.
window.
in
which
that
object
to
type
is,
to
you
trace
can
type
the
complaint
the
context
evaluate
return
back
any
another
to
the
from
Smalltalk
occurred.
is a
global
object
object
the
current
messages.
that
In
the
one
for
takes
you
requested
context
The
above
all
one
the
in
order
value
example,
objects
level
evaluation
to
of
objects
we
defined
lower
at
locate
are
in
in
its
the

WRITING SMALLTALK
Now
type:
filin
'mysquare'!
After
a few
The
Type
seconds,
square 1001
result
shows
size!
that
try:
you
have
~ROGRAMS
retrieved
your
program.
Page
15
You will
square
that
Special
Small
talk
Small
talk
to
adults
typical
use:
Grjoe
(meaning
directly
This
distinction
Paris
We
shouldn't
Paris
but
rather:
'Paris'
get a complaint
uses
it.
The
Characters
uses a number
students
is
usually
the
at
the
is a
has
has
literal
symbol
exists
large
say:
five
five
to
(").
letters.
letters.
object
help
The
symbol
itself.
in
English
city
in
that
of
special
remind
children
'joe'
France.
"symbol
size
has
them
rather
also.
has
no
value
"iconic"
of
important
preferred
than
We
can
no
value"
in a more
characters,
to
what
say:
because
global
distinctions.
use
(@:»
or
who
now size
context.
many
of
An
to
signify a literal
'joe'
may
only
which
example
stand
belongs
were
is
for)--the
invented
"quote"
symbol,
to
hand
the
by
whose
since
object
some
sign
in
its
points
to
indicate
the
literal
word
rather
than
the
city.

WRITING SMALLTALK
PROGRAMS
Page
16
Keyboard
(Note,
presents
Equivalents
there
the
methods
To
-------
!
~
<t
0
0
n
=>
1t
®
0
?
's
done!
~
~
$.
%
@
!
$
are
Get
usually
most
You
several
commonly
Type
--------
LF do
<shift>
<shift>
<ctrl><shirt>;
<ctrl>
<shirt>
<shift> 1
<shift>
<shift>
<ctrl>
<ctrl>
<ctrl>
<shirt> <ctrl>
<ctrl>
<ctrl>
<ctrl>
<ctrl> 2
<ctrl> 1
<ctrl> 0
<ctrl> 4
'
5
k
/
2
7
1
s
d
<
>
=
v
ways
to
used.)
We
Call
-----------
it
hand
eyeball
keyhole,
if
...
return
smiley
unary
less
greater
not
percent
"at"
explana
double
dollar
type a special
It
(look
for)
"peek"
then
minus
than
or
equal
than
or
equal
sign
sign
tion
quote
sign
sign
equal
keyboard
character.
The
following
table
Summary
<esc>
<ctrI> D
c
<shift> <esc>
fix
redo
of
Special
<number>
<number>
Dialog
Escape
blinking
Assuming
window.
While
values
Creates a sub-dialog
operation
window you
Enters
is
<number>
Re-sends
<number>
Window
to
the
"top
the
prompt
you
have
inside a diagnostic
so
you
can
investigate
of
the
current
can
type
the
Small
talk
transactions
Small
talk
transactions
Operations
level"
or
Small
talk;
character
entered a diagnostic
window,
the
cause
window
any
editor
the
window
Small
for a
back
message
back
from
within
until
talk
command
from
on
where
should
changes
of
an
the
current
you
message.
where
you
command
youare
return
window,
the
error.
dialog
type
line
in
are
line
currently
you
returns
context
window,
<ctrD
the
dialog
currently
<number>
typing.
to
the
you
of
D.
window.
typing.
dialog
to
names
suspending
Within
where
the
and
the
The
the
window
dialog
their
the
sub-
line
line
is

WRITING
SMALLTALK
PROGRAMS
Page
17
Boxes: An
First
get
the
box
filin
'boxes' I
After
a few
blinks
Type
to
Smalltalk:
~joe
<f-
A
small
box
member
"boxness",
joe
and
and
joe
will
joe
of a
particularly
grow
get
joe
turn
grow
bigger.
Introduction
programs
they
will
box!
will
appear
class
or
group
those
50
!
Try:
30
!
-20
!
by
typing:
arrive.
in
the
of
concerned
to
top
objects
Small
center
resembling
with
talk
of
your
position,
screen.
boxes,
size,
it
and
You
can
tilt.
have
receive
Try:
given
messages
it
the
having
name
joe. As a
to
do
with
joe
will
A
new
answer
Now
Both
in
the
and
(Don't
We
see
which
joe
turn,
Gr
jill
box
the
try:
repeat
of
the
upper
joe's
jill's
forget
from
can
is
1 !
grow,
<f-
box !
will
appear.
question
(joe
individuals
left
size!
size
!
that's
this
do
similar
and
jill
turn
hand
and
answer
Type
is ? wi
20.
respond.
corner
is
typed
the
things.
similar
jill
little
that
th
turn
To
of
your
as
< ctrl>
"movie"
he
messages
box
(as
-11)
"escape"
keyboard.
is a
s)
which
did
!
box
to
joe).
from
correctly.
jill
using
the
Ask
the
we
created
Now
different
endless
questions:
that
try:
loop,
joe
numbers
press
and
jill
the
key
are
for
really
size
and
marked
separate
tilt.
'ESC'
jill
will
located
entities

WRITING
An
analogy
we
find
useful
between
properties
human
the
a
particular
than
"thing"
In
object).
sending
to
object.
The
among
object's
or
an
A
(we
values
natural
Small
it;
it
central
objects
action
Look
individuals
such
and
talk,
Objects
and
receives
name
SMALLTALK PROGRAMS
to
these
ideas
is
the
common
the
idea
of
as
often
are
quantities
kind
language
"action".
every
receiving
idea
in
and
that
at
the
that
'name',
say
instance
of
rolling
entity
can
remember
messages.
messages
in
writing
the
created
then
is a
reply
Class
grouping
we would
'age',
(as
with a value
gait
and
thus
is
and
Small
environment.
mentioning
from a class
Box
'weight',
of
the
for
make
called
things
The
possibly
talk
human
like
class
'walk').
an
class
programs,
the
message.
sends
notion
to
'walk',
for
no
object;
about
of
classification
beings
human)
Small
distinction
handles
produces a reply,
A message is
into a class
discuss
'eat',
has
'weight'),
talk's
every
themselves
this
then,
Either
the
message.
them
is
by
because
in
the
abstract.
'eyecolor',
particular
and
some
semantics
between
object
and
communication
to
define
sent
the
and
values
are
are
the
belongs
can
communicate
typically a message
classes
to
an
programmer
similar
we
many
for
actions
at a more
rather
to
a
for
every
which
object
(via
properties.
see
so
many
The
class
others.
these
properties.
(an
individual
comprehensive
crude
class
handle
by
direct
English
(which
with
object
to
first
Page
For
example,
similarities
"human"
Each
individual
Some
may
notions
is
also
each
other
which
belongs
send
to
another
communication
mentioning
keyboard
typing)
18
has
of
have
level
of
an
by
the
As
an
example
to
introduce
encorporates
Note
that
that
will
be
The
definition
to
box
var
(<(draw
<1undraw
<1turn
<1grow
isnew
add
to
turtle
of a
class
the
special
most
of
what
you
can
also
examine
introduced,
by
show < classname
of
box
is
I x y
size
tilt
(®
=>
(@
=>
(SELF
=>
(SELF
=>
(Grx
=>
@=>(<( place
definition,
Small
talk
is
complex
the
typing-
> !
place x y
white.
undraw.
undraw.
(-
Gry
r:J"=>tilt (-O.
=>
(SELF
here
is
symbols
about
classes
turn
tilt.
SELF
draw. ® black)
@=>tilt (-tilt
ursize (-size
(-
256.
SELF
penup
gota
a box.
Small
we
and
have
Its
syntax.
talk.
already
square
G?size (-50.
draw)}
!
(:)(:)
various
size.)
+:.
+:.
pendn
parts
It
is a
discussed
SELF
draw.)
SELF
up.
are
described
very
simple
(turtle,
draw.)
1tBELF)}
class
window),
!
below.
definition,
as
They
well
serve
as
but
any
to
square
(GT
do 4
length
length (-:.
(®
go
length
turn
90})!

WRITING
ad
.
The
dto
to
extend
The
message,
without
the
response
put
leaving a trace).
SMALLTALK PROGRAMS
object
addto
definition
is
to
its
pen
have
down,
is
of
the
useful
turtle).
turtle
and
face
for
extending
Here,
pick
in
an
we give a
up
upward
its
the
definition
turtle
pen,
go
direction
of
an
the
ability
to a screen
(that
is,
object
to
respond
position
it
places
(in
this
to
that
itself
case,
the
message
is
received
at a new
Page
we
used
position
19
it
place.
as
a
square.
Chapter
the
To
I.
message,
draw a square
The
Explanation
The
format
We
use
Everything
storing a name
contexts
gain
access
have
only
turtle,
Notice
which
for
to
(class-name>
the
symbol,
following
in
which a message
to
been
window,
that
more
('{? < class
is
more
initial
was
also
of
the
teaching
(names
(names
(messages
with
objects
working
fontchar,
consistently,
name
like
box
explanation
given
in
Definition
Small
of
of
to,
to
refer
the
name
its
meaning
and
their
at
the
are
>
~
class <
(messages
on
the
of
Chapter
of
the
talk
about a new
(temporary
screen,
the
I.
we
use
colon,
:,
the
Box
Class
class
variables> I
the
definition
Smalltalk
of
objects
properties describing each member
properties describing the
to receive
is
might
meanings
highest
found
we
temporary
and
and
actions
to
the
next
object
its
value;
in a dictionary.
be
in
might
sent;
level
the
have
it
typically
that
(top
top-level
preferred
variables> I
responses)!
is
useful
There
were
level)
class
(class
to
talle)
as a literal
to
think
can
dictionaries
defined
of
Small
dictionary.
the
format
(instance
!
in
symbol
is
(instance
variables»
class
of
be
different
any
talk
variables> I
of square
for
variables»
name
this
format
dictionaries
are
nested
higher
level
context.
that
fetching
(here,
as
so
of
The
(class
was
constructed
the
next
I
the
name
the
mechanism
for
the
that
an
context.
definitions
variables>
value
is
different
object
So
far
of
in
in
box).
for
can
we
box,
(iF
the
method
object
as a literal
Title
Line
Words
The
Class
In
locations
that
the
The
distinguish
location
orientation
different
between
vertical
and
the
title
distinguish
class.
definition
<name> ~ <value>!
for
bar,
Instance
line,
needed
members
of
the
on
sizes,
creating
name
the
/,
only
each
of
the
box
the
and
instances
and
word to
in
the
Variables
three
different
when a member
member
class
of
the
on
the
screen.
different
the
part
and
the
title
is used
of
the
box
specifies
class;
screen;
Hence,
orientations.
of
the
classes.
after
the
arrow,
first
left
parenthesis
as a delimiter
kinds
of
names
of
the
class is
class;
and a temporary
size
two
and
two
kinds
is
the
members
names
of
length
of
Here
+-,
is
for
can
actually
of
names:
variable
the
we use
the
are
the
different
be
objects
of
each
class
the
object's
referred
specified:
doing
that
the
four
(var).
of
its
box
can
symbol
meaning.
to
kinds
something;
have
Gr
to
refer
to
the
as
the
title
of
the
definition.
of
variables.
names
are
properties
Properties x and y define
sides;
for
common
(x,
and
different
temporary
names
to
all
y,
size,
tilt
is
screen
of
properties
members
tilt)
its
locations,
next
storage
angle
of
that
the
of

WRITING
SMALLTALK PROGRAMS
Page
20
Messages
All
members
responds
request
messages
message,
The
because
Small
to
symbol
it
talk
joe
Small
talk
and
finds
box
in
the
screen
coordinates
In
matches
question:
"token"
grow,
position.
sequential
to
(grow
and
to
two
learn
that
are
«,
is
the
grow
sees
that
context
equal
the
do I
refer
Actions
of
the
messages
the
each
given
within
("eyeball")
used
to
message
100
the
it
is
For
to
order,
message
see
to a single
50),
read,
class
class
member
look
!
name
an
instance
of
joej
example,
256.
joe looks
grow
the
following
(read
box
respond
which
type
of
parentheses
is
in
at
the
have
(is),
the
class
front
message.
to
joe, looks joe
of
the
that
is,
with
joe's
dictionary
(with
with
the
word
token
word
or a group
eval
print).
messages
been
adopted
and a request
can
receive,
after
the
title
of
each
of
the
Suppose
up
in
its
class
box.
Therefore,
the
knowledge
might
the
«)
for
grow
in
as
the
next
of
words
to
grow,
as
reasonable
to
learn
and
line.
message
we
have
dictionary
of a dictionary
indicate
the
message
the
definition.
token
enclosed
turn,
the
words.
created
of
Small
in
by
draw
and
conventions
about
actions
names
talk
that
the
each
The
the
size is 50,
draw,
Use
the
message?
parentheses.
undraw.
for
class'
will
symbol
box
named
and
their
runs
the
containing
undraw,
of
the
Examples
Each
Smalltalk
properties
take
upon
resembles
associated
definition
joe's
tilt
and
eyeball,
We
will
member
receiving
an
joe
and
of
size,
a,
and x and
turn,
«,
is
use
of
tokens
also
classes:
('s).
'rhe
eyeball
we
send
meanings,
the
class
tilt,
and
and
then
asking
the
word
arc:
a
a
y
a
Conditional
Within
itemization
the
clause)
the
messages.
else-clause).
not-false
In
the
box
you
see
the
may
be
asked
significance
to
have
the
message
The
Suppose
in
specific
joe's
on
The
The
value
Message
order
size
the
screen.
Message
action
of
sender.
a
to
value
the
Actions
main
set
of
the
This
value;
increases
it
definition,
following
in a conditional
in
Smalltalk--any
boolean
Grow
box
sees
erase
itself
of
the
Turn
taken
if a box
instance
of
parentheses
messages
itemization
The
must
be
the
if-clauses
word
in
val~e
"true".
the
message
from
change
by 100.
sees
variable
for
each
member
is
actually
then-clause
enclosed
the
within
message?"
statement.
object
The
grow.
the
screen.
is
received
The
box
the
message
tilt,
and
the
class
of
the
in
the
consists
parentheses.
of
most
of
Any
The
with a value
object,
The
action
It
then
as a
message
then
sends
turn
then
tells
definition,
class
can
form
of a conditional
of
the
the
conditional
question
choice
however,
other
the
changes
itself
is
similar:
itself
of
box
using
the
to
we
receive
actions
that
the
than
returns
takes
the
the
message
the
draw
provide
that
statements
can
word
the
its
is
value
Small
box
again.
(virtually
and
the
statement
will
occur
be
answered
"not-false"
boolean
"not-false"
to
send
of
size
talk
symbol
draw
in
tells
itself
methods
(if-clause
if
are
simply
"false"
rather
value
"false"
value
itself
the
by
colon,:.
order
to
undraw,
in
tabular
for
the
some
to
show
responding
if
-clause
questi'ons
or
"not-false"
than
"true"
is
considered
for
use
message
amount.
In
itself
changes
form)
=>
(then-
has
by
undraw
this
case,
again
an
to
a
"do
has
the
The
the

WRITING
The
Message
The
meaning
box's
orientation
box's
sides.
white)
in
order
SMALLTALK
Draw
of
draw
is
to
(tilt),
and
Undraw
to
simply
"erase"
the
PROGRAMS
place
the
call
on
the
changes
drawing
turtle
object
the
of
the
at
the
square
turtle's
square
box's
with
color
box.
screen
the
to
white
location
message
(assuming
(x,
size,
y),
the
the
turn
the
length
of
background
turtle
each
Page
in
of
color
21
the
the
is
Again,
manner.
message
The
Message
The
Small
created.
(i.e.,
describing
for
the
the
screen.
The
l\1essage
To
have
a box
and
y.
Edit
box
<I
Try
notice
as
As
it
that
each
is
able.
Isnew
talk
object
If
so,
the
the
class
member).
If
a
Small
isnew
Move
a
box
grow, we
in a different
and
add
to
move
=>
(SELF
the
evaluation
object
isnew
usual
new
talk
must
position
the
is
evaluated,
is a
consequent
member
In
box,
class
be
asked
change
on
definition
undraw.
(reading)
it
special
the
the
question
is
of
the
new
is
to
have
as
part
instance
the
display
~x~:.
of
a
Small
is
given
the
that
the
action
class
instance
any
of
the
variable
screen,
GT'y~:.
by
assigning
also
members
definition
SELF
of
we
talk
message
opportunity
determines
giving
sends
size;
values
values
itself a message
(instances)
of
the
to
want
to
draw.)
if a new
to
class.
have
redraw
is
to
to
each
a
box
done
in a left-to-right
read
as
instance
each
of
name
to
at
all,
the
turn,
the
box
much
of
the
of
the
class
the
instance
in a dictionary
draw a square
question
we
change
with
new
tilt.
values
(linear)
remaining
is
being
variables
created
shape
on
To
put
for
x
joe move
joe
for
The
third
lower
right
repea.t
The
above
action
new
Suppose,
is
values
joe
In
other
left,
up,
The
Smalltalk
100
move
200
i
~
50
to
message
corner.
(joe
is a method
to
tell
itself
from
instead,
move
right
words,
or
if
down
statement
200.
lOa.!
250
causes
To
move
the
we
a box
and
by
10
joe
have
mx
my)
for
to
erase
message,
would
like
50.
joe move
sees
then
might
(joe
to
joe
move i
move
track
i)
across
the
mouse
!
having
the
receive a number
from
and
to
message
be
the
then
type
left
box
the
screen
drawing
messages
100.
move,
!
the
screen
cursor,
move
to
(undraw),
itself
such
joe move
then
value
diagonally
simply
an
absolute
again
as
up
it
should
to
determine
change
(draw).
30.
type
joe
look
from
location
the
values
move
down
for
one
by
how
the
on
of
much
upper
left
the
screen.
of x and
10.!
the
four
to
increment x or
corner
The
y by
receiving
messages
to
the
box's
right,
y.

WRITING SMALLTALK PROGRAMS
<t
move
=>
The
to
evaluate
three
Also
move
case.
use
of
actions:
note
methods
Try
<t
move
{SELF
{«right
SELF
parentheses
the
last
(1)
that
moving
(relative
=>
(SELF
(<(right
SELF
«left
«up
«down
part
SELF
«left
«up
«down
Gr
x
draw)
undraw.
=>
(~xt-x+:.)
=>
(Grxt-x-:.)
=>
(Gryt-y-:.)
=>
(~yt-y+:))
draw)
around
up
and
the
of
the
undraw.
means
absolute)
conditional
statement
(2)
decreasing
undraw.
=>
(@:>xt-x+:.)
=>
(Grxt-x-:.)
=>
(Gryt-y-:.)
=>
(Gryt-y+:)
t-:.
(?
y
t-
:.)
-
(SELF
look
for
available,
statement
(<(right
draw);
one
of
the
directional
the y coordinate.
we
could
make
the
If
one
=>
reply
we
·(say
()
... )
to
the
messages,
wanted
the
allows
message
and
to
have
absolute
each
(3)
one)
possible
move
SELF
both
the
Page
22
form
contains
draw.
kinds
default
of
The
There
the
name
class
they
The
same
or
or
The
class
name
the
literal
sitting
The
the
next
in
looking
<l
only
Message
are
two
of
instance.
have
not
add
to box GT-(<(is
message
as
one
already
joe
joe is
joe is
method
name
(in
(GT'box).
class
in
the
"open
colon"
words
at
fetches
Is.
messages
the
class;
We
already
is,
by
is
1!
box!
turtle!
for
responding
this
Otherwise,
name.
message,
symbol
enclosed
the
message
the
we
include,
the
other
adopt
the
been
included
=>
(<(box
«'s
=>
(@='
convention,
known.
to
case,
box),
see
Otherwise,
gather
(8)
in
parentheses)
literally.
expression
by
is
word
is
=>
var
t-
is a request
So
we
might
is
(shown
is
the
if
the
the
it
up
but
is a
Small
if
there
convention,
the
ability
for
the
in
your
{11'
(iT>
8.
«t-
say
and
be
and
be
and
be
in
next
next
word
answer
do
not
talk
literally
However,
is
an
in
to
evaluate
first
message,
definition
box)
« 1
=>
(11'
var
to
learn
told
box
told
box
told
false
the
above
word
in
in
the
must
evaluate
symbol
as
the 8 always
exact
match.
each
the
(i.e.,
the
be
that
it
of
=>
t-
message
false.
it
appears
class
messages
and
box,
then
(11'
r:;r
:.)
11'
var
name
of
not-false)
definition
message.
In
(8).
Then
says:
fetch
in
fetches
definition.
within
the
possessive
type
box)
8.11'
eval))!
the
class
of
box)
If
it
is a
question
order
to
return
the
the
message.
in
the
false)
or
involves
is,
return
not
next
next
One
the
for's
to
mark
leave
false.
token
is
the
context
for
ask
if
seeing
(11')
(?).
the
(the
1'he
literal
ability
of
the
the
second.
the
name
(<I)
the
literal
If
it
is,
incorrect
next
8 is
similar
expression;
to
learn
class
is
if
return
name
word
to
or
If
the
the
class
or
«
the

WRITING
The
Message
The
message
context
the
What
and
for
The
the
is
take
word is
var
sequentially
because
box
~x
W'h
will
see
the
class
method
meaning
the
back
on
the
of
the
joe
ff-
be
that
the
not
message
of
the
SMALLTALK
'S
('8)
is, by
convention, a request
message
is 50
100!
joe's
the
the
instance),
for
responding
of a
arrow
next
the
back
left
Smalltalk
receiver
and
we
say
x!
value
of
value
of
the
temporary
(4-).
If
value
in
arrow,
eval).
to
right,
method
PROGRAMS
(typically,
h?
At
the
x is 100j
value
is 50.
to's
involves
object
it
is a
the
then
Again,
but
(here
back
message
simply
note
that
for
main
but,
Hence
receiving
named
arrow,
(:).
return
that
the
letting
to
the
class
(top)
within
the
then.
(I.e.,
the
message
each
evaluate
or
level
the
context
assigned
the
var),
and
return
this
is a
the
value
evaluation
is
actually
object
the
of
next
read
Small
(1t)
of
the
next
instance
talk
of
joe
value
token
then
seeing
the
method
the
meaning
of a Small
grouped
as
much
token
in
the
of
the
class).
we
examine
(looking
of h must
literally
result
of
indirect
of
in
be
50.
(8),
assigning
if
the
next
of
letting
reference.)
of
var
talk
message
in a right-associative
the
message
message
Suppose
the
global
the
dictionary
word
the
(obtained
as
within
the
dictionary
this
in
the
meaning
If
by
is
carried
it
chooses.
Page
the
size
created
token
message
of
var
the
next
sending
out
manner
23
of
as
Receiving
There
is
not
<I,
colon,
following
friend
received);
my
(note,
I
information
8
words,
(1)
simply
(2)
(3)
stack.
(4)
from
(5)
the
to be
a message; I
friend
however,
can
also
in
the
message
An
object
mentioning
The
Each
The
RECEIVER
the
When
ability
used
action
message
Messages
one
:,
and
way--
when
read
the
that
choose
Crom
(let's
of
attempt
the
RECEIVER
to
send
by
the
global
suppose I just
he
to
message
open
colon,
wait
finishes
rest
of
this
to
include
my
message
the
Criend).
call
the
RECEIVER's
message
to
receive
uses
at
the
top
and
receive
CALLER.
until
reading
my
can
it
the
sending
the
of
completes
to
which
8)
referj
received a message; I read
my
message,
be
done
permission
and
to
However,
CALLER)
information
eyeball,
the
stack.
messages
all
message
rather,
friend
his
give
name
forms a stack
his
reads
message, I return
but
then I can
using
the
in
my
that
inCormation
anything
can
followed
typically
«,
the
colon,
actions,
returns
messages
his
Smalltalk
message
my
send a message
by
of
messages;
means
.,
the
to
the
"fetches"
message
Criend Cetches, I
the
and
message
CALLER.
(use
form a hierarchy
part
(the
to
reading
not
get
the
object
message.
to
my
to
him
to
the
looking
the
at
apply
another
open
the
The
of
the
Smalltalk
which
of
it
and
decide I should
one I sent
my
message. I can
message
which
will
friend
(accomplished
last
at
to
can
no
object
message
the
message
colon,
8,
top of
the
HECEIVER
him,
back
ask
by
longer
(the
sent
to
stack
symbols
we
explain
not
choose
to
read
be
discussed
me
to
including
have.
RECEIVER)
is
put
on
the
receive
is
removed
may
return a value
eyeball,
in
the
send
my
the
one
to
let
it
myself
later).
fetch
some
<I,
:,
In
other
by
on
the
top.
top
of
the
information
and
I
or
(6)
This
means
receiver).
CALLER
information
that
sequence
each
Each
becomes
remaining
of
sending
message
time
the
the
current
in
and
on
the
RECEIVER
RECEIVER.
his
messago.
receiving
stack
has a CALLER
is
messages,
finished,
The
his
now
viewed
(message
message
current
here
as a
sender)
is
removed
RECEIVER
process
and
from
can
of
stacking
RECEIVER
the
stack
continue
messages,
(message
and
reading
the
any

WRITING
(7)
Initially,
CALLER. .
(8)
If
further
RECEIVER
(9)
By
CALLER's
RECEIVER;
(10)
There
is
the
keyhole,
does
not
the
message
of
the
use
SMALLTALK
the
the
RECEIVER's
information
is no
longer
calling
on
remaining
he
can,
are
two
a,
remove
of
in
# is
the
order
given
RECEIVER
message
from
the
available
the
object
message.
however,
further
that
lets
the
information
to
send a reference
at
the
PROGRAMS
is
the
first
contains a eyeball,
CALLER's
to
the
apply,
special
end
the
The
CALLER
read
anything
Small
RECEIVER
from
of
the
the
object
message.
CALLER.
CALLER.
can
that
talk
symbols
"peek"
message.
to
the
next
next
chapter.
in
the
Any
can
no
remains
at
The
token
message
<I,
colon,
information
give
the
longer
after
useful
the
message.
second
typed
RECEIVER
get
the
in
sending
symbol
rather
by
the
:,
or
open
successfully
information
RECEIVER
and
It
is
the
is
thn
than
the
programmer,
colon,
the
right
that
completes
receiving
same
as
hash
mark,
token
itself.
who
8,
he
can
obtained
to
see
all
is
read
its
actions.
messages.
the g except
#,
placed
An
Page
24
is
the
obtain
by
the
of
the
by
the
One
in
example
it
Alternative
An
alternative
message
Let's
a message, message
the
RECEIVER
After
fetch
contains a colon
A
amount
returns
Similarly
instance
appropriate
redraw,
(start
enclosed
The
examine
box
the
comes
(as
stated
of
control
determining
alternative
redraw
will
by
Box
method
to
the
becomes a CALLER,
of
message B
action
for
variable
of
from
(:)
in
(8)
the
box's
to
messages
messages
obtain
parentheses.
box
Definition
for
simplify
definition
A.
In
undrawing
the
remaining
directing
above).
growth.
its
CALLER.
containing
(that
is,
within
the
value
the
value
definition
defining
methods
the
sees
This
both x and y in
the
for
in
terms
of
definition
sending
the
token
is
completed,
part
it
to
get
information
remaining
The
RECEIVER
The
CALLER's
the
parentheses.
of
changing
of
the
message)
follows.
class
growing,
of
box
steps
of
box
itself
redraw;
message
part
tokens
(Then
both
is
given
turning,
(1)-(8)
provided
another
the
RECEIVER
B (rJ?size
from
of
then
actions
turn
the
the
the x and
at
below.
and
of
the
previous
below,
message,
as a result,
the
remaining
message A
sends
itself
are
now
or
move.
case
of
move),
fetch
for a value
the
the
next
The
main
difference
moving
boxes.
section.
if
message A contains
B--redraw
it
sends
itself
requests a fetch
f-
size
+
:.).
part
of
contains a number
the
message
completed.
In
order
to
it
was
necessary
found
y.)
In
general, a colon
token--either
a
is
·the
Suppose a box
the
rJ?sizef-size+:.
the
message
for a
value
This
part
of
t.he
CALLER's
that
determines
draw,
change
in
single
the
after
more
to
action
word
use
receives
token
undraw.
(:.).
message
message
which
than
enclose
taken
will
activate
or
of
the
grow,
The
The
the
one
the
by
words
B
it

WRITING
SMALLTALK
PROGRAMS
Page
25
to box
(<(draw
«undraw
«redraw
«turn
«grow
«move
«is
isnew
Extending
show
one
the
box
class
var
the
in
I x y size
=>
=>
=>
=>
Box
the
next
to
be a class
tilt
(®
place x y
(®
white.
(SELF
(SELF
(SELF
(SELF
(@=>var
(<[box
(~x
Grtilt
Definition.
section:
whose
turn
SELF
undraw.
redraw
redraw
redraw
+-
=>
+-
(/?y ~ 256.
~
the
members
(~x
g.
<I
('ltGT-box) <I ?
O.
SELF
There
class
of
,tilt. square
draw. ® black)
:.
SELF
~tilt
~
tilt
draw.)
+
@="size ~ size +
+-
:.
~y+-:.)}
+-
=>
(1t
var
+-
=>
('ltGrbox)
Grsize
draw)}
are
several
polygons,
each
'own
+-
!
ways
and,
an
size.)
:.
)
:.)
:.)
'It
50.
to
after
instance
var
eval}
g.
1tfalse)
extend
introducing
of
the
or
turtle
modify
the
the
class
class.
box
turtle,
class.
we
We
will
modify

WRITING
SMALLTALK
PROGRAMS
Page
26
Class
This
simple
length.
lines.
the
turtle
turn
is
Using
to polygon
of
The
After
will
an
even
to poly
(@=»sides
the
box
(<(
« grow
Polygons
extension
object
drawing
have
turned a complete
division
sides
size
f-
do sides
draw
(®
definition
var
I x y
=>
=>
to
class
that
draws
each
of
:.
Grsize
go
as a model,
size
(@
(<(sides
« size
box
allows
any
polygon
line,
the
turtle
circle
360
(360/number-of-sides).
f-
:.
size
turn
360lsides))1
we
can
tilt
sides
place x y
=>
(SELF
=>
(SELF
turn
us
to
must
has
(360
define
tilt.
redraw
redraw
create
to
poly
ask
turn
units).
a class
1'he
or
The
square.
length
objects
the
turtle
enough
units
Since
A
polygon-drawing
for
polygons.
title
line
sides
as
an
sides
size)
method
poly
or
each
that
to
each
is
similar
instance
for
drawing
expects
side.
have
draw
so
angle
variable.
any
that,
to
two
@='sidesf-sides+:.)
Grsizef-siz~+:.))
We
adopt
joe
joe
as
the
two
use
is
(G1-var +-8.
SELF
message
grow
grow
redraw
forms
size
100.
sides
50.
alternative
var+-var
meanings
eval+:.).
number
the
appropriate
after
drawing
of a polygon
routine
that
or
box;
has
changed.
messages:
of
grow.
of
is
we
We
number
Another
sides
all
is
added
use
of
number
the
equal,
the
poly,
or
sides
method
equal
of
lines,
each
number
not
and
to
Responses
by
convention,
a
Smalltalk
<lis
This
object
possible
In
send
isnew,
the
to
initial
@=>joe f-polygon
Gr
joe ~ polygon
Then
we
write
isnew
to
messages
is
object,
=>
([SIT
is
part
type
show < class-name)
we
must
value
redraw,
similar,
ISIT,
but
and
eval)
of
the
give sides a
of sides as a
3!
6!
as
part
of
the
=>
(@='sides~:.
@'>tilt f-O.
SELF
@='size f-50.
@'>x~@'>yf-256.
draw.)
undraw,
looks
use
basic
Small
value
message
definition
turn,
'5,
for
the
word polygon.
talk
system
in
order
to
as
well
as
when
creates a triangle
creates a hexagon
of
poly
see
the
we
and
move,
referenced
any
other
create
such
are
the
Or,
alternatively,
in
"basic"
instance
an
instance
same
as
subsequent
objects.
properties.
of
polygon.
in
box.
we
can
sections.
Suppose
take
I.e.,
The
advantage
It
we
message
is
always
choose
is,
of
to

WRITING
Turtles
The
turtle
can
get a turtle
programs.
Type
SMALLTALK PROGRAMS
examples
to
in
the
draw
first
section
designs,
showed
sketch,
and
so.me
make
of
the
diagrams
messages
any
with a number
turtle
can
of
useful
Page
understand.
and
27
We
simple
G1="pokey f-turtle
Now
pokey
go
<n>
turn
pen
up,
black,
xor
goto
goto
up
erase
understands
<n>
pendn
white
<n>
<m>
(point>
!
messages
Where n is
Where n is
Change
state
A
turtle
This
color
(white
for
width
is
where
nand m are
<point>
try
Le.,
Points
Clears
entire
is
goto
the
the
screen.
an
an
can
says
black,
1.
an
go
to
the
turtle's
window.
intcger,
integer,
of
pen
have
that
instance
mp
point
move n units
change
that
can
three
ink
whatcver
black
the
horizontal,
of
the
where
orientation
frame
orientation
leave a trace.
colors:
"color"
for
white).
class
the
mouse
(dir)
in
which
forward
black,
is
This
vertical
point
cursor
towards
the
(+)
right
white,
on
the
works
locations
explained
is
placed.
top
turtle
lives;
or
backward
(+)
or
left
or
xor.
screen,
show
only
on
the
in a subsequent
of
screen.
default
(-).
(-).
its
when
display
window
complement
the
turtle's
screen.
section;
is
the
We
down
Also,
home
f-
<string>
can
the
pokey's
pokey
pokey
x,
pokey's
query
the
turtle's
'CTRL'
key).
ink
'5
(lir
'5
width
y,
pen,
and
frame.
<property> f-<value>!
property
For
example,
We
can
Goes
Prints
turtle's
you
background
underneath.
values
change
to
center
the
current
can
make
using's
these
of
the
text
(string
location,
non-destructive
so
that
(typed
values
window
of
characters
with
reshowing
by
striking
by
typing
frame.
its
text
the
enclosed
direction,
by
using
text
crases
the
key
by
single
width,
xor
ink
it
marked
which
while
quote
and
restoring
'8'
marks)
color.
Note
complements
what
while
holding
at
the
that
the
was

WRITING
SMALLTALK PROGRAMS
Page
28
Usually,
display
other
properties.
pokey's
A
simple
to
Try
pokey
design
pokey
design
It
is
probably
the
ability
designs.
addto
The
explanations
method
message
The
arrow
only
the
width,
screen
window,
width
design
design
program
var
(~varto:.
erase home
89.
home
up.
91!
better
to
receive
addto
lets
turtle
GT(<(design
of «
for
looking
and
the
word
(=»
denotes a conditional
whose
are
to
2!
might
i
for
up.
Small
talk
the
message design.
us
add
new messages
(eyeball),
at
the
following
value
modified
be:
pokey
i to
300
programming
=>
(cJrvar
SELF,
message
the
is
an
in
this
go a little,
(pokey
and
and
and
seeing
«.
The
statement
integer
manner.
go i
style
In
this
responses
to
:.
for
=>
were
use
of
turn
between 1 and
There
turn
some
var))
to
modify
way,
i to
given
if
there
of « is a test
the
all
to
300
form
!
the
turtles,
class
(SELF
in
is a
8,
are
alternative
amount,
turtle
not
definitions.
go i
the
previous
match
whose
value
and
frame,
methods
go a little
class
definition
just
pokey,
Try
turn
var
section.
between
is
either
)))!
the
whose
for
more,
and
will
be
Recall
next
not-false
value
each
and
so
give
able
that « is
word
or
is
of
on.
turtles
to
draw
in
false.
a
the
a
the
<test
for
<otherwise
truth>
do
=>
this>
«action
to
take
if
the
value
of
the
boolean
expression
is
true»

WRITING
SMALLTALK
PROGRAMS
Page
29
Boxes
The
Each
Owning
definition
time
appropriate
instance
correctly
In
the
new
box.
The
turn
a box, we
that
turt
the
geometric
so
the
box
and
size.
to box
(isnew
«draw
<lundraw
of box
an
instance
direction.
of
boxj
positioned.
definition
turtle,
whom
actually
is
sitting
shape.
no
longer
var I turt
=>
=>
=>
Turtles
as
presented
is
drawn
Rather
since
the
of
box
we
named
move
at
the
correct
The
turt
has
to
retain
size
(~turt
turt
place
SELF
(do 4 (turt
(turt
white.
earlier
or
erased, ® must
than
having
instance
given
below, we
turt,
or
turn
the
display
remembers
this
f-
turtle.
256
256.
draw.)
go size
SELF
depends
to
reposition ® each
"owns"
its
use a different
is
an
instance
turt
belonging
coordinate,
its
position
information.
@:=>size f-50.
turn
90))
draw.
turt
on
the
be
placed
turtle,
variable
turned
(x,
There
black)
turtle ® to
at
we
can
turtle
of
to
that
box.
in
y)
and
are
Create
turt
size
the
value
starting
Ask
Change
position
the
turtle's
draw
each
the
appropriate
time,
we
might
assume
to
the
that
draw
class box.
When
the
proper
its
direction,
orientation
now only two
as
an
instance
50.
Place
and
orientation.
turtle
to
draw a square.
ink,
assume
instance
location
assign a turtle
the
each
instance
Each
we
draw
(tilt)
instance
of
class
the
turtle
background
of
facing
turtle
time
a box,
waiting
on
variables:
turtle
at
the
of
we
we
the
and
is
the
to
is
always
the
move
assume
to
screen,
give
white.
class.
in
the
each
class
draw
turt
or
There
were
(1)
draw--we
do we
need
(2)
turn--since
direction
(3)
move--the
instance
«redraw
«turn
«move
«grow
=>
=>
=>
=>
several
no
longer
to
use
the
the
(send
turt
turtle
variables x and
(SELF
(SELF
(SELF
(SELF
changes
need
object
turtle
the
message
remembers
y.
undraw.
redraw
redraw
redraw
to
the
to
square.
must
turn).
:.
SELF
draw.)
turt
turn
:.)
turt
penup
~sizef-size+:.))!
box
definition.
reposition
sit
in
the
The
his,
and
go
the
turtle
proper
box
no
therefore
.
Hather
the
(:)
pendn)
This
is
always
useful
because
direction,
longer
the
turtle
positive,
has
box's,
than
to
is a
new
moves
if
you
turt
we
tilt
instance
changing
change
kind
of
move
in
the
think
of
is
already
the
box
variable
position.
value
his
orientation.
move--move
backward
direction
the
box as a
correctly
by
The
of
tilt,
forward
if
negative.
of
spaceship!
changing
tilt.
box
we
simply
if
amount
his
tilt.
This
positioned,
thc
turtlc's
no
longer
tell
Turtle
is
nor
has

WRITING
SMALLTALK
PROGRAMS
Page
30
Dispframes: An
Small
talk
this
class
already
changing
screen).
corner
and
this
cursor
cursor
x>
hide.
task,
is
points.
display
Each
instance
named
buf.
(1)
(2)
(3)
Placing
There
are
class
dispframe.
dialog
can
seen,
its
To
(upper
You
a
inside
coordinates
changing
lining
scrolling
when
Text
three
windows
show
text
Small
talk
size,
displaying
do
these
left
have
sent
dispframe
the
The
response
x,y.
of
a
dispframe
One
of
the
physical
the
characters
(deleting
the
window
011
ways
Introduction
are
instances
in a rectangular
can
have
text,
tasks,
an
instance
corner
window;
the
to
y>,
growto
messages
understands
and
to
the
remembers
jobs
of
the
lines
up
the
can
not
Display
place
text
many
and
to
the
the
corner
message
class
when
evenly
initial
properly
Screen
on
the
to
Text
of
the
area
that
dispframes,
hiding
of
dispframe
(lower
windows
messages
<x>
(y>,
corner is a
text
that
dispframe
the
characters
in
the
characters
contain
display
Display
basic
Smalltalk
can
each
itself
understands
right
corner
by
pointing
hasmouse,
to
is
is
to
right
margin
and
all
screen,
be
framed
one
(deleting
x>
to
determine
number
displayed
fit
the
fill
the
(right
readjusting
the
text.
one
system
capable
(lower
at
determine
class
with
thick
of
its
representation
messages
right
one
of
the
at
which
dispframe.
black
moving
such
as
corner y>,
four
whether
corner,
lines.
its
corners.
between 1 and 4 depending
in
the
rectangular
text
into
the
window:
line
space
("line
wrap
justify),
the
remaining
uses a turtle,
the
characters
other
screen
from
moveto
show,
or
not
if
any,
area.
around"),
two
Members
As
you
position,
the
display
(upper
display,
To
help
the
mouse
the
mouse
on
This
text
upward)
rely
on
of
have
left
in
the
is
the
With
Turtles.
~amy
amy
amy
The
word
x,y
position.
amy's
amy
Try
printing
Although
looks
best
With
rectangular
length,
~
This
creates a rectangular
characters.
<f-
penup
<f-
'
hello'!
"hello"
Now
width
<f-
'hi'!
it
is
when
Display
area
and a string.
dp
<f-
The
<dispframe>
turtle!
goto
100 100
appears
amy
<f-
2!
with
turtles
possible
the
turtle's
Frames.
and
its
The
dispframe
simplest
put
on
has
been
to
print
To
contents:
string
100
way
<text>
pendn!
the
screen.
repositioned
facing
text
direction
create
the
is
the
75
100 120
area
75 x 120
to
place
at
<x>
in
different
on
is
a
area's
method
text
<y>!
the
The
upper
at
the
display
horizontal,
dispframe
upper
for
string
at
in
this
Amy
has
Note
the
left
corner
end
of
Increase
Print
another
directions
with a turtle
vertical,
you
send
left
corner
storing
200.!
location
area
is
width
need
for
the
displayed
amy's
width
word.
and
or
at
at
x,
the
text
100,100.
to
send
= 1
and
single
of
the
to
having
facing
45
least
its
characters
the
faces
upward.
quote
first
word.
2.
different
in
any
degree
angles.
five
width,
It
its
can
dispframe
marks
as
character
widths
direction,
messages
upper
to
be
displayed.
contain
the
delimiters.
shows
and
text
describing
left
corner
up
to
message
at
amy's
colors.
generally
the
y,
200
text
put.
its

WRITING SMALLTALK PROGRAMS
Page
31
Where
x,y
dp
Now
try
dp
Notice
with
that
the
repeat
to
place
the
Appending
message
basic
~,
class
dp ~ 'hello'.!
Now
try:
dp ~ 'how
Do you
see
dispframe?
characters
are
put
put
text
when
named
are
the
'hi
there'
'hi
where'
the
dispframe
'hi
where',
(dp
word
Text
are
how
the
The
appended
display
at
at
screen
150
200
has
but
put
'hi'
at
mx
"hi"
all
over
to
Display
sent
to
a
dispframe,
string.
you
We
today?
line-wrap-around
original
to
text
the
coordinates.
100!
ISO!
changed
it
has
my)!
the
screen.
Frames.
can
print
My
was
end.
its
not
erased
is a
the
name
works? And
not
cleared
Now
For
example,
x,y
position'
the
original
A
dispframe
request
word
"hello"
is
dp
and 1 am a dispframe'!
to
stores
add
in
that
when
new
try
the
various
to
200,150.
text
'hi
characters
the
spaces
characters
other
It
there'.
its
text
to
dispframe
have
to
messages
has
replaced
Try
in a place
bufi
buf
dp
by
typing:
be
explicitly
were
added;
to
a
dispframe:
its
named
is
an
rather,
original
instance
stored
buf.
into
the
text
The
oC
the
new
a
dp
dp
dp
dp
dp
dp
dp
dp
dp
dp
dp
dp
hide!
display!
fclear!
show!
clear!
show!
hide!
growto
display!
hide!
moveto
display!
250
50
250!
50!
The
The
This
Now
Now
entire
text
area
empties
the
frame
the
frame
area
is
the
disappears
cleared
string
is
larger.
is
in a new
and
and
represented.
bur
so
position.
reappears.
there
is no
longer
text
to
display.

WRITING
SMALLTALK PROGRAMS
Page
32
Boxes
The
levels
the
were
The
of
A
the
do,
such
We
a
as
Small
of
mouse
grabbing.
next
a
dispframe.
menu
is
object
or
names
as
to
have
polygon.
polygon.
where
the
We will
determined
polygon
joe
Men
us
talk
class
editor
the
class
definitionj
cursor
in
the
Instances
mfindc
mfindw
mfindt
(which
(which
(which
or
example
an
with
receive
was
ordered
the
of
other
and/or
chosen
list
mouse
objects
chosen a simple
The
result
Before
polygon
the
is
new
to
use a modified
from a message
by
typing
uses
window
of
dispframe
character),
word),
token,
set
of
of
cursor.
to
send
example
of
grabbing
instance
be
drawn.
version
received
two
the
second
and
that
words
in
order
objects
to
retrieve
messages).
of a menu
of
instances
is
the
.editor was
understancl
and
is,
which
enclosed
to
clarify
that
can·
The
objects
or
a word will
is
actually
the
definition
at
the
time
of
dispframe.
the
menu
three
word
in
parentheses).
the
be
selected
might
to
"activate"
consisting
be
created,
the
window.
able
use
be
of a list
to
create
the
of
polygon,
object
The
In
to
determine
messages
of
these
in a variety
words
or
(that
is,
of
the
user
will
one
is
created.
first
is
the
each
case,
you
which
that
aid
in
messages
pictures,
give
words,
of
and
ways.
each
the
each
corresponding
select
in
which
For
the
example,
window
were
character
this
task:
to
provide
One
way
representing
ability
word
being
instance
position
the
polygon
we
containing
able
to
or
an
is
to
to
do
something,
the
of
on
position
will
position
word
example
point
things
name
the
the
screen
create
the
you
at
to
of
class
is
the
G?joe f-polygon 5 150
to
polygon
(<ldraw=,>
isnew
=>
The
dcfinit.ion
instance
store a list
of
the
of
of
the
typing:
@=>
pm ~ polygonmenu
The
list
code vector
the
screen.
Each
I sides
size
(do
(Grsides
G?@
SELF
polygonmenu
basic
Small
names
owned
item
in
100!
®
sides
(®
f-
:.
f-
turtle.
draw))!
talk
of
the
possible
(triangle
by
pm
codevector
go
size
turn
UT'size f-50.
® place
includes
class
(:)(:).
the
vector, a
polygons
square
is now a
refers
list
to a polygon
360/sides))
instance
method
to
create.
pentagon
of polygon
joe
is a pentagon
polygon
Draws
Values
provided
variable
for
storing a list
For
hexagon
names
that
can
simply
creates
it
on
the
-screen.
for
sides
when
the
codevector.
example,
septagon
that
will
be
created.
(5
sides)
the
and
the
polygon
This
of
things.
we
might
octagon)!
appear
at
150,100
object.
turtle's
is
created.
position
object
In
create a menu
in
the
will
this
menu
are
be
case,
box
an
we
by
on

WRITING
to
polygonmenu
SMALLTALK PROGRAMS
i I
dp
,codevector
Page
33
(isnew
~(~cadevectar
repeat
The
above
definition
for
printing
method.
then
codevector[i] = cadevectar[
Each
item
the
message
from
the
dispframe
iteration
The
in
atom
area
is
to
each
counter
the
list
chars
Grtriangle
by
send
word
is
by
sending
the
~
8.
(buttan
4
(Grdp f-dispframe
far
i to codevectar
(dp f-cadevectar[i]
done))))!
of
palygonmenu
from
the
list
is
ii
cadevectar[i]
1]
an
atam,
a
basic
forming a string
would
the
string
dispframe
dp
=>
simply
is
to
=
Grtriangle.
Small
of
characters
be
the
'triangle'
the
string
When
creating a menu,
be
displayed
--
Wait
(01'
po~itionj
position;
mx
and
return.
length
We
name[index]
shows a rectangular
count
refers
talk
string
to
system
'triangle'.
to
codevector[i]
75
my
print
- 1
chars.
reference
down
the
for
the
then
through
ith
class.
the
dispframe.
in
the
the
user
create
120
string
each
dp f-13).
item.
atom
The
chars.
menu
word
items
area
Each
to
press
dp,
100.
in
in
each
For
instance
value.
word
Hence
letch
literally
•.
button 4 to
the
dispframe,
the
a
filled
item
example,
For
"triangle"
menu
vector
with
using
of
example,
the
the
vector
indicate
at
the
followed
using
words.
the
in
the
an
atom
is
contents
o(
the
mouse
by a
the
The
for
iteration
above,
responds
the
response
printed
of
words
menu
cursor's
carriage
notation:
method
if
i=l
in
the
far
to
to
a
The
code
dispframe.
Now
let's
add
If
we
send
reply
from
codevector,
of
the
first
to
the
first
pTn
index!
(16550100)
To
select
addto
for a carriage
This
causes
find
the
word
to
palyganmenu
a
polyganmenu
the
dispframe).
the x position
character
word
in
the
the
menu
word
polygonmenu
return
each
to
in
which
Gr(
of
the
is 13.
new
<lindex
the
The
the
word.
word
the
message
four
first
menu.
from
cadevectar, we
GT(
<lselect ~ (Grif-SELF
Hence
to
appear
mouse
=>
(1tdp
index,
numbers
character
Suppose,
The
result
word
ill
fourth
is
dpf-13
cursor
mfindt
we
in
as
is a vector.
the
menu.
the
retrieve
is a method
on a new
points.
mx
will
are:
the
the
word,
an
example,
The
.y
position.
the
index.
for
line
in
the
my))!
receive a list
The
second
'Nord
i[
1
do
actual
the
Jth
index
widt.h of
we
type
first
number
is
the x position,
height
item
something
printing a carriage
menu.
(vector)
pm
is
generally
in
the
with
of
of
the
the
word,
index
while
in
the
vector
third
14.
vector.
cadevector[i[
four
word
and
is
the
return
in
numbers
in
the
vector
the y position
we
are
pointing
the
index
word
width,
I]]))!
(the
of
the
the
and

WRITING
SM:ALLTALK
PROGRAMS
Page
34
Suppose
we
button.
<lselect ~ (repeat
The
done
part
we
do
is
simply
not
necessary
<Iselect ~ (repeat
But,
again,
before
the
<Iselect ~ (repeat
<Idraw
We
can
complete
word.
It
height.
There
expects
For
want
is
to
there
figure
=>
is a
four
messages:
example:
to
delay
important.
to
call
retrieve
is
no
is
drawn.
(repeat
repeat
the
menu
special
computing
(button
It
on
the
the
i[ 1 ]th
(button
delay
Let's
(button
(button
(button
(polygon
selection
routine,
the
4
~
(~i
do
stops
the
polygon
item
4
~
(Gr
polygon
provided
change
4
~
(Gr
SELF
0 ~ (done))
4
~
(:)
by
dcomp,
area's
upper
until
the
f-
SELF
something
repeating
class
with
in
code vector .
if-SELF
2+i[1]
in
order
the
response
if-SELF
draw
mx
my.
adding
that
lets
left
user
index.
with
and
sides = 2+i[
index.
mx
to
allow
to
index.
2+i[1].
done)))
the
ability
us
complement
corner
x,
can
point
codevector
returns
1].
my.
done)))
the
user
draw.
done)))
Make
certain
wait
for
button
to
complement
the
width,
into
[i[
control
Hence,
to
that
any
the
the
menu
1]
].
done)))
to
the
in
point
someplace
the
button
press
before
the
rectangular
upper
and
message
this
case,
is
released.
calling
color
area
left
corner
press a mouse
sender.
it
on
on
polygon.
of
the
of
is
actually
the
Then
selected
the
y,
What
screen
screen.
and
the
dcomp
Try
do
The
height
dcomp
The
change
Of
course,
response
check
to
token.
100
100
(dcomp
of
the
i[2] i[3] i[4]
to
the
«select
we
assumed
to
index
see
if
i =
The
completed
50
100
font
class
=>
(repeat
to
-1.
200!
100
50
we
are
definition
(button
the
first
see
If
it
definition
100
200)!
using
is 14, so,
14.
is
4
=>
(Gri +-SELF
dcomp
SELF
dcornp
done))
index
if
does,
was a
the
then
i[2] i[3]
draw
i[2]
)
mouse
is:
to
index.
2 +
i[3] i[4]
reasonable
cursor
the
cursor
complement a word
i[4]
14.
i[l].
14.
number.
is
inside
was
inside
the
the
It
frame,
in
the
is
safer
frame
menu,
and,
but
to
check!
if
so,
was
we
use
We
to
compute i and
not
pointing
change
at
the
any

WRITING SMALLTALK PROGRAMS
Page
35
Another
The
message
depend
menu
Within
have
to poly
(<(index
«select
«draw
isnew
kind
on
the
to
be
the
gonmenu
=>
=>
(repeat
=>
(repeat
=>
(~codevector
repeat
of
menu
might
order
be
of
hexagon
triangle
circle
repeat-loop
i I
(dp
hasmouse
1tfalse)
repeat
(button
might
an
the
of
dp
code vee tor
=>(GFi f-dp
{button 4 =>
((G1='i f-SELF
done)))
(button
(button
use
item
0
4
f-
8.
4
=>
the
index
in a vector
polygonmenu
the
response
mfindt
index)
mx
=>(dcomp
SELF
dcomp
,_
=>
(done))
=>
(polygon
(:)
mx
(G?dp f-dispframe
for
i to codevector
(dp f-codevector[i]
of
the
menu
word
of
messages.
to
to
the
determine
message
which
select
my.
ill]
=
i[2] i[3]
draw
2 +
i[l].
i[2]
i[3]
my.
done)))
mx
75
my
length
- 1
chars.
selected
For
examplet suppose
polygon
replacing
t
was
-1
=>
(1t
false)
i[4]
14.
i[4]
l4.done)
120
string
dp
to
choose a message
created.
SELF
f-
100.
13).
we
draw
1ti)
done))))!
did
not
PossiblYt
2+i[
1] t we
to
evaluate.
want
we
want
might
to
a
GT'((polygon 6 mx
Here
i[
1]
is
the
index
message eval
Chapters
in
order
IV
and V contain
my)
(polygon 3 mx
into
the
to
obtain
more
vector
the
of
desired
information
my)(polygon
messages.
polygon.
and
examples
We
10
select
mx
about
my))
an
[ill]]
item
the
from
classes
eval
the
vector
dispframe
and
and
send
vector.
it
the

WRITING
SMALLTALK
PROGRAMS
Page
36
A Few
Some
of
certain
text
that
Small
talk
filin
dragon'
to
(~length
length
length
dragon
Try
® erase
hilbert
to
Sketching
our
favorite
that
you
have a large
you
can
editor.
'turtlefns'l
dragon
length
= 0
> 0
-length+
home
space
((@='i
hil
(i
hill
filler
i a b
f-
>
O=>
(G?a
Gra
hil2
:)
f-
Tricks
design
see
in
Alternatively,
f-
,'.
=>
(®
=>
(dragon
up.
= 0
f-
90.
-
90.
hill)l
programs
the
window. You
go
10)
1.
®
turn -90.
dragon
=>
(®
Grb f-i-I)
@=>b
enough
you
length
81
turn
f-
i +
can
-1.
180)
1)
are
presented
window
can
retrieve
®
turn
dragon
below.
to
accommodate
type
part
of
these
turtle
90.
dragon -(length-l
length
+
1.)
Caution:
the
routine
routines
1
all
your
from
) )
if
you
typing.
and
add
the
copy
the
disk
these
Small
rest
pack
routines,
talk
by
by
only
using
typing
be
sees
the
to
to
i is
the
® erase
hil
squiggles
to
(
to
Try
® erase. ®'s
hill
(®
turn
hil2
(®
go
recursion
home
41
squig90
repeat
(©
home
(0
go
rand
a.
hil
10.
hil
number.
do
rand
Crt'ctri
width
up
200
0 -
b.
/
f-
®
I
1000
i *
f-
b.
®
turn
Try
turn
5)!
2.
(!Pi f-11.
turn
a)!
0 - a. ® go
90
*
rand
10
turn
nwd
squig90!
4)))!
0 -
a.
hil
b.
®
go
10)1

WRITING
Or
to
squiggle
(@'>i
repeat
(©
do
SMALLTALK
i
~
13.
home.
1000
(®
go
10
turn
PROGRAMS
rand)))!
Page
37
® erase. ®
Changing
®
®
Sketching.
repeat
or
repeat
The
routine
Members
detail
in
More
sketching
to
draw
(repeat
(button
ink
color
home
home
We
(pokey
(pokey
mp
of
the
Chapter
button
button
pokey
'S
up
erase.
up
turn
can
returns
class
IV.
control
4
=>
2
=>
7
=>
penup
width
and
the
90. ®
sketch
goto
goto
point
is
(pokey
(pokey
(done)
goto
~
1.
width
®'s
width
'5
by
mx
my)
mp)
the
respond
obtained
pendn
erase)
mp))
squiggle
of
width
telling
!
!
point
with
goto
!
!
the
turtle's
~
1.
~
2.
any
where
to
messages
the
mp)
dragon
dragon
turtle
the
mouse
trace
makes
8.
8.
!
to
follow
mouse
is
x y + - =
buttons.
for
the
mouse
located
max
interesting
cursor.
(that
is,
min.
This
variations.
For
example,
it
combines
class
is
Try
mx
described
and
in
my).
more
draw!
Now
lines
(button
otherwise,
mouse
(bottom).
Variations
to
"Rubber
lines,
the
position.
device,
allow
always
top
are
2)
erases
the
Henceforth,
use
selective
Bands"
stretching
mouse
drawn
the
turtle
one
the
erasure.
is
button;
only
screen;
moves
having
we
mouse
another
when
to
buttons
will
button
towards
the
bottom
you
press
holding
the
cursor
ordered
refer
to
to
control
sketching
the
mouse
mouse
the
down
without
from
the
top-to-bottom
changing
technique
cursor.
button
top
mouse
all
the
mouse
leaving a trace.
top
in
The
indicates
to
bottom,
the
which
button
buttons
version.)
turtle's
a
line
starts
that
(button
(button
(Note,
the
width
turtle
at
the
4);
there
other
and
expands
the
line
the
7)
terminates
ordered
changing
point
is
to
bottom
are
two
left
and
contracts
indicated
be
fixed
mouse
the
versions
(top)
turtle's
in
programj
to
ink
straight
by
pressing
its
current
button
of
the
right
color

WRITING
to
rubberband
{repeat
(button
SMALLTALK
fp
sp
4
=>
(@
penup
repeat
(@
goto
button
@
white
PROGRAMS
goto
r:itfp~mp
~sp~mp.
2
=>
(done)
penup
goto
pendn.
fp
pendn
goto
sp
goto
fp
black))))
Page
38
!
Saving
storing
the
mouse
~
repeat
Here,
(described
the
reset end.
rubber
band
the
sketch.
to
newrubberband
(G?points ~ stream
(3:::.
points ~ newrubberband!
The
sketch
to
reconstruct
points
fp,
points
sp,
is
points ~ stream
(@
goto
points ~ mp)!
object
in
Each
can
detail
time
be
points
in
modified
repeat
(button
button
can
7
=>
(done
4
=>
be
reconstructed
pts
((G=>pts ~ :.
repeat
®
(pts
penup
lets
of
is
Chapter
the
turtle
fp
sp
(@
penup
repeat
(@
button
®
pts
end
go
to
you
store
the
vector
10!
an
instance
IV).
Members
to
moves,
store
each
the
pair
points
of
vector
with
goto
white
10.
stream
goto
(JJ=>sp~mp.
2
=>
penup
by
of
Ci.?fp~mp
(points ~ fp.
goto
reset.
=>
(done)
pts
next
pendn
method
of
the
of
new
(fx,
points
fp
goto
for
constructing
class
the
class
turtle
sx),
making
contents)
pendn.
points ~ sp.
pendn
pts
goto
next))!
stream,
stream
location
sp
a
respond
is
these
done)
goto
the
drawing. A simple
method
stored
lines
fp
for
to
messages
(f-)
available
black))))
in
storing
points.
for
!
example
other
objects
~
contents
The
reconstructing
next
routine
of
reconstruct
That
is,
Chinese
"Chinese
mouse
to
reset
Brush
Brush
button.
brush
(ur@)
repeat
points!
the
stream,
Strokes.
Strokes".
i ®
~
(button
button
®
turtle.
penup
and
Changing
This
2
=>
(®
4
=>
(®
goto
repeatedly
the
class
lets
erase)
pendn.
repeat
(rID's
button
mp.
@=>i~O.))
retrieve
width
you
draw
width
0
!
the
next
of
the
variable-width
~
(G=>i~
=>
(done)))
item
turtle's
1
+i
mod
until
path
8.
reaching
as a line
lines
as
®
goto
the
long
mp.
is
end.
being
as
you
drawn
press
leaves
the
top

WRITING
SMALLTALK
PROGRAMS
Page
39
Feather
"Ceather
Strokes.
stroke".
to f eder
(®
to
abs
((~x
Cobwebs
The
creation
vector
coordinates
of
press
Small
is
turt's
the
talk.
to cobweb n i
(@=>n ~ 10.
@='turt ~ turtle
turt's
Grxs ~ vector
repeat
ox
penup.
repeat
(button
button
x
This
also
for
ink.
top
(button
(xs[
(J=>i
®
repeat
This
next
oy
nx
ny
4=>
(®
goto
repeat .
(button
®'s
width
® goto
2
=>(®
erase)))!
~
:)
< 0
=>
last
class
uses a second
of
this
turtle
explained
use
®'s
mouse
width
1 to
~
1.
penup
(0
= mouse 4=>(done)
@':>i
turt
® goto
turt
by
turt.
width
button.
xs
ys
turt
®'s
frame
~
1.
n.
4=>
n] ~ all
goto
~
1 + i
penup
xs[i] ~ mx
pendn
in
is
width
turt's
Grys ~ vector
xs[
mod
goto
go to
class
~ox
0
=>
@=>ox ~ nx
(1to -
with
Chapter
The
class cobweb
set
to 3 and
Clearly,
~
®'s
ink ~ :.
mx.
1]
n.
xs[i]
xs[i]
varies
the
~
mx
~oy
(@
penup.
~
1 + abs
(3
Groy ~ ny))
x)
1tx)!
turtle,
the
message
IV. A vector is
turt's
this
3.
@'s
ink ~ :.
frame.
n.
ys[
1 to
n] ~ all
ys[
1]
pendn.
ys[i].
ys[i] ~ my.
ys[i]))))!
thickness
~
my
of
the
pendn.
done)
*
(G1='ny ~ my) -oy)
turt,
to
Corm
frame
expects
sketching
width
is
explained
used
two
messages,
is
set
method
my.
trace
cobwebs
here
as a method
to
1. Cobwebs
is
depending
I
(~nx
around
in
Chapters
the
color
designed
store
mx
store
my
of
are
for
in
in
on
~
the
IV
for
®'s
drawn
all
all
the
direction
mx) -ox.
lines
drawn
and
Vj
storing
ink
and
as
the
color
of
vector
of
vector
the
®'s
the
long
version
xs
ys
of
the
by
®.
class
display
color
as
you
of
In
the
black-and-white
cobweb
(-3)
(-3)1
version
of
Small
talk,
type

WRITING
SMALLTALK PROGRAMS
Page
40
Paint
Small
specially
Small
A
Brush
talk
talk
filin
'xyfns'l
sufficient
to
rectangle I origin
(<(
<I
«
<I
<I
isnew
As
you
can
movement
instances
method
a
rectangle,
~source
also
has a method
constructed
is
through
abbreviated
has
=>
(@at
-n-
center
of
for
'S
=>
is
=>
paint
=>
see,
of
the
working
type
+-
=>
Cit
g
([SIT
=>
(CODE
(@aorigin
this
bits
class
rectangle
(upper
<extent
for
transferring
to
resemble a gray
the
class
rectangle.
version
is
"color".
This
extent
+-
:.
origin t origin + extent)
(1t
origin + point
extent
eual)
eual)
43)
+-
.'.
(J'=>extent +-.'.))!
definition
on
the
point,
with
left
corner point>
of
area
display
a
basic
two
coordinates
as
a
point
includes
screen.
system
whose
blocks
xl2
an
The
class
as
one
parts
class
extent
escape
two
defined
entity,
are
of
designs,
The
basic
definition
y12)
to
machine
instance
completely
for
the
area's
such
method
is
available
code
variables,
in
example,
width
as a solid
of
interfacing
by
typing
(CODE)
origin
Chapter
as a display
and
height>!
black
which
and
IV.
rectangle,
brush
supports
extent,
The
class
point.
or
painting
must
point
To
create
one
to
the
be
is
a
For
example,
~source
1'he
rectangle
Suppose
white
newspaper
by
The
same
form a pattern
ABC
Where
you
dots
painting
destination
size
as
D
A,B,C,D
to
print).
---)
try
+-
rectangle
does
not,
want
to
fill
form a spatial
The
"gray"
the
which
into
is
designated
source.
then
I A I
I n I
I
C I
I
D I
are
binary
point
50
50
point
10
20!
as
yet,
appear
the
rectangle
half-tone
number 1 represents a black
the
source
as
"Gray" is
gets
numbers.
on
with
rectangle
a point,
specified
replicated
For
the
display.
"color".
which
and
the
upper
as
an
throughout
example,
gives
then
width
"Gray
the
dot,
transferring
left
integer
the
suppose
is
10,
color"
impression
0 a
white
corner
which
area
being
the
desired
height
is
of a
gets
is
20
obtained
of a
dot.
The
from
the
rectangle
folded
painted.
gray
by
gray
"paint
source
that
into
The
pattern
combining
color
(like
brushing"
to a destination.
will
be
a 4x4
rectangle
folding
is
is
black
that
made
and
in
works
the
to

WRITING
1101
0111
1101
0111
The
corresponding
1101
SMALLTALK
single
0111
1101
0111
PROGRAMS
binary
number
is
Page
41
which
in
numbers
@'='dest ~ mp.!
SOll,rce
source
source
Now
try
source
source
The
number
o
4
8
12
Each
of
above
operation
o
1
2
3
octal
is
in
Small
paint
paint 0 dest!
paint 0 mp!
paint 4 dest!
paint 8 dest
following
these
four
code.
0153727.
talk
must
12
0153727!
the
copy
source
copy
complement
source
fill
source
operations
store
source
OR
source
XOR
source
AND
complement
Hence,
begin
the
with
32125!
message
paint
to
destination
of
brushes a new
with a gray
has
one
into
destination
into
destination
into
destination
of
integer
the
number
Place
Store
Copy
Copy
Copy
The
gray
same
is
an
'operation
point
source
gray
to
to
destination
of 4 modes,
(paint--do
(merge
(invert)
source
into
to
store
0.)
Try
the
mouse
the
gray
the
source
the
source
the
complement
integer
into
size
as
32125
the
the
destination
obtained
the
destination
as
the
paint
cursor
somewhere
"color"
into
into
the
into
the
of
is
another
destination
source.
indicator.
point
point
by
operation
l's
and
(erase)
"color"
the
source
destination.
mouse
point
the
source
"gray"
where
As we
adding
as
indicated
D's)
is
on
the
rectangle.
destination.
orea
color.
the
destination
have
the
following
0153727.
screen.
into
the
This
seen:
above)
(Note,
destination.
brushes
is a
rectangle
integers
the
to
octal
new
the
the
Hence,
source
source
source
source
and
so
-1
32125
(Recall
holding
you
might
paint 1 dest!
paint 2 dest!
paint 5 dest!
paint
on.
Some
-5161
that
down
the
the
try
the
10
dest
integers
-21931
negative
key
marked
following
32125!
you
might
23130
indicator
'SHIFT'.)
variations
use
as
15420
sign
5160
is
using
Take
Take
Take
Source
gray
typed
objects
source
and
source
and
complement
brushes
include
-32126
as
(shift)-,
source
OR
XOR
of
the
XOR
(these
0
it
to
it
to
source
of
are
11892
that
and
the
destination.
the
destination.
and
the
decimal
-10213
is,
dest
OR
gray
press
defined
it
to
the
(32125)
numbers)
13260
the
above.
destination.
to
the
51
key
marked
destination.
-52
'-'
while

WRITING
SMALLTALI{
PROGRAMS
Page
42
Suppose
~
The
shape
~
and
the
~
The
palette
®
@'s
do
The
combination
brush
To
spread
repeat
Try
building
you
want
to
create a shaped
palette +-rectangle
can
be a paint
brush +-rectangle
tone
is
one
of
the
tone
f-
15420!
is
then
the
mixture
penup
goto
brush
width
f-
8.
2
(®
go 2
turn
is
paint
8 palette'S
the
paint
around,
(button
your
own
4
=>
painting
point
brush
point
numbers
center
90)1
origin
try
(palette
area
0 0
point
shape.
20
20
representing
of
brush
pendn.
tonel
paint 8 mp
system
of
point
and
using
gray
16
161
16
tone
tone))!
the
color
16!
the
..
Design
Small
in
gray
talk
the
color.
the
painting
upper
brush.
left
portion
brushes.
of
the
screen.
BITBLTing.
one
part
of
used
with
to
BLT
It
requires
1
2
3
4
5
6
7
8
9
10
11
12
Without
shape
too
and
A
part
the
memory
caution
(CODE
twelve
base
address
destination
destination
destination
destination
destination
operation
base
address
source
source
source
gray
color
much
color
of
of
the
of
is
41)1
messages
of
raster
x
width
y
height
code
of
raster
x
y
explanation,
the
mouse
Small
the
which
the
destination
as
defined
the
source
cursor.
talk
system
computer
are,
in
above
of
we
offer
to
another,
order:
of
for
blocks
the
is
the
blocks
of
paint
of
bits
following
ability
quickly.
bits
useful
to
move
The
definitions
blocks
Small
talk
for
of
bits
program
saving
(O's
and
and 1 's)
that
should
changing
from
be
the

WRITING
to
cursor p buf
(<l
<l
<I
<l
to
PNT
Try
SMALLTALK
gray
loadfrom
(~p
BLT
copy
(@='p ~ :.
BLT
show
(@=>buf ~ :.
BLT
makebuff
(@=>buf ~ string
~ P ~
BLT
11'
(mem
to
=>
buf
~
=>
255
=>
:.
281
1 0
mem
60
~p
281
1 0
=>
PNT
p+2 1 0
))!
~
PROGRAMS
16 0 16
32
p x
~
PNT
16 0 16
32.
buf,
16 0 16 0 281
:.11'
mem
255)!
0
mem
16
P Y
16 0 281
buf.
0 p+2 1 0 0
60
32
1 0 0
P x P Y
1 0 0
0)
O.
0)
0)
Page
43
Grsource f-rectangle
@=>savecursor f-cursor
Or
source
cursor
cursor
try
the
palette
cursor
paint
loadfrom
show
loadfrom
Now
The
repeat
cursor
(button
looks
12
-5161!
source'S
savecursor!
example
palette's
4
=>
(palette
like
the
paint
point
0 0
mahebuff!
origin!
given
earlier.
origin!
brush!
point
paint
Then
8
16
mp
16!
A
Paint
loadfrom
8
Restore
say
tone))!
string
containing
gray
requires a pointer
16x16
area
the
color
(source
cursor
in
bits
the
rectangle
to
original
representing
source
rectangle.
to
the
upper
shape.
the
upper
left
cursor.
left
corner).
cornor
of

THE
SMALLTALK
WORLD
AND
ITS
PRIMITIVES
Page
44
Chapter
Up
to
this
presentation.
discussion
assume,
Small
however,
talk
o
o
=>
1t
SELF
I
symbol
III.
of
point,
In
the
THE
we
this
chapter,
basic
Small
that
set
presented
look
to
receive
receive
the
message.
indicates
return
taken
message.
name
delimiter
title
line
SMALLTALK WORLD AND ITS PRIMITIVES
have
provided a "try
and
talk
the
reader
there.
see
if
a
the
next
the
next
conditional
the
following
is
to
run
used
to
refer
used
of a class
in
the
concepts:
has
examined
The
specific
value
from
literal
statement:
object;
this
object's
within a class
between
definition.
next,
classes,
following
word
appears
the
token
the
names
it
and
we
instances,
earlier
is a
message.
(single
if-clause
object
class
definition
of
see
modify
chapters
summary
as
the
word
is
definition
class,
instance,
the
flavour
the
style
and
message
and
of
next
word
or
words
=>
(then-clause)
"active"
and
to
the
in
these
in
enclosed
in
the
to
active
and
of
what
order
sending
is
familiar
symbols.
the
message.
else-clause.
sense
let
this
instance
temporary
happens"
to
and
in
that
object
style
provide a direct
receiving.
with
the
special
parentheses)
the
next
action
examine
of a class.
variables
in
of
We
from
the
the
Objects
Every
entity
with
each
other
object).
every
Examples
The
object
of
Class
number
string
atom
vector
turtle
Message
A
message
Messages
alphanumeric
characters,
is
are
in
Smalltalk's
by
class
which
objects:
Name
Sending
sent
to
simply
characters
or
(3)
one
sending
handles
belongs
Objects
3 4
'this
x y
(1
©
and
an
object
strings
of
world
is
and
receiving
all
communication
to
it.
3.14159
is
some
file3
3 5 7 9 11
Receiving
by
first
of
words
beginning
the
special
called
an
messages.
text'
number
mentioning
separated
with
symbols
object.
(receiving a message
6.28e-23
'here
is
Every
some
Objects
more'
13)
the
object
by
spaces.
an
alphabetic
listed
above,
®,
can
remember
object
character,
and
or
belongs
then
A
any
and
possibly
mentioning
"word"
(2) a string
arithmetic
things
and
to a class
is
either
(which
producing a reply)
the
operator.
communicate
is
also
message.
(1) a string
of
all
numeric
an
for
of

THE
SMALLTALK WORLD AND ITS
PRIMITIVES
Page
45
Examples
of
sending
Communication
---------------
3+4+5
1.
5
mod
go
turn
grow
turn
for
100
go
grow
of
messages
3 5
50
90.)
50
25.
30.
an
2.
'abc'+'def'
3.
®
4.
do 4 do
5.
(®
joe
6.
joe
7.
jill
The
class
ways
as
returning a message
object
to
messages:
Object
--------
3
'abc'
®
joe
joe
jill
can
receive
be
received.
to
the
Message
+4+5
4 none
messages
Once a message
sender
(reply)
-------
mod
3 2
+'def'
go
100
(®
go
turn
90.)
grow
turn
25
grow
Reply
12
'abcdef'
®
50
none
50
none
30
none
in a variety
is
received,
or
modifying a graphic
Graphics
------------------
none
none
none
draws a line
draws a square
units
50
joe,
the
sides
by
joe
turns
jill
grows
of
ways.
In
the
object
display
J\ction
100
long
box,
grows
50
units
25
degrees
her
addition,
can
(graphics
units
with
sides
the
take
side
his
30
user
some
long
units
can
action,
action).
add
new
such
Notes
on
the
Communication
3+4+5
1.
The
expression
at a simpler
<1+
The
action
Then
return
active
simplified
Small
this
Hence,
In
from
is
4
computed
to
instance
talk
example.
example
the
sent
sees
the + and
the
original
after
rest
the
Examples:
3+4+5
message:
=>
(cJ='b
taken
(1't)
of
example,
code as
Such
seeing
1,
after
of
the
message
and 9 is
sender.
~:.
after
to
the
the
the
in
the
escapes
the
the
message.
+5,
tries
returned
Object
3
is
handled
3+4.
In
the
1t
'result
seeing
'+',
to
All
the
sender a reply
class
(referred
value
of
first
example,
are
seen
the
receiver
object 3 first
In
which
will
get a value
to 3 as
messages
Message
+4+5
by
sending
class
of
computing
'+'
is
SELF
in
this
case,
activate
(5)
the
in
the
number,
the
to
receive a value
calculated
to
by
the
is 3
and
but
can
the
definition
(3)
receives a value
sees
the
the
the
into
ITS
value
of
Smalltalk
Reply
12
reply
we
have
sum
somehow.
name
the
value
also
be
message
rest
of
same
'b'.
its
message.
are
handled
of
of
an
as
CODE
+,
the
line
There
Graphics
none
the
message
SELF
and
from
The
SELF)
of b is 4.
escape
<number>.)
(4)
the
action
message
in
the
is
nothing
The 3 adds
in a similar
b')
the
message
calculation
as
well
(This
to
lower
and
returns
ctr b
is <1+5.
definition
Action
4+5
as
more
itself
manner.
back
and
the
is
usually
levels
the
(-:.
The
of
number
in
to
to
3.
give
uses
value
of
sum
tries
to
4 is a
the
message
the 9 and
First,
let's
it
the
name
the
value
of
of
b.
In
done
using
the
system,
(7).
rl'ceive a value
number
as 3 was
also.
so
4+5
returns
look
b.
the
the
more
as
in
It
using.
is
12

THE
SMALLTALK WORLD AND
ITS
PRJ~ITIVES
Page
46
Communication
2. 5
In
which
of
numerical
the
the
mod
example
class
number
«mod:::>
This
means:
you
the
then
do
receive a value
the
it
the
then
3
above, a
number
with
value.
The
Cit
SELF
if,
in
see
word
'mod'
the
following:
message
name
return
dividing
by
multiplying
by
and
resul t from
a
reply
the
that
subtracting
to
value
same
Object
5
message
can
recognize
respect
part
-
the
message,
from
and
give
b
the
sender
calculated
yourself
received;
the
result
value;
this
yourself.
Message
mod
is
sent
(we'll
to
another
of
class
number
(r.?
b ~ :.) * SELF I b)
<I
mod
=>
~b
1t
by
SELF/b
b *
last
SELF
3
to a member
see
how
in a bit).
number.
SELF/b
which
...
:.
- b*
We
receiv~s
SELF
Reply
2
of
need
I b
Graphics
none
class
number
It
indicates a desire
another
this
item
general
Action
(the
literal
from
message
for
the
form
5).
'mod'
finding
message,
looks
is a token
the
modulo
this
like:
time
a
To
clarify
explanation
value
is
able
object
finds
effects
the
value
and
that
reference
division
multiplication
Most
of
communication
Since
"expressions"
which
determined
Small
If
a
previous
the
(that
to
examine
in
the
an
arithmetic
the
evaluation
of b is
see
the
multiplication
to
operation.
lines
in
everything
have
talk
by
number
example
right-associative
of
the
above
message.
is,
the
returned
the
rest
message,
an
multiplication
SELF, a number
is
class
(as
already
conditionally
the
can
answer
here,
operator
of
instance
is
The
the
subtrahend;
definitions
by
sending
in
Small
in
example
been
user
or
(which
the
indicated, a fetch
calculated.
included
the
was
nature
value
is
of
the
SELF.
(-)
and
parenthesized
of
number.
operator
that
result
as
of
the
resemble
and
receiving
talk
is
1)
can
actions
as
question
given
of
the
The
uparrow
an
object
message).
Because
asks
message
This
(so
far,
sees
the
the
divison
result
this
an
object
be
built
The
messages
'specified
part
of
is
number
the
name
evaluation,
Cit)
that
The
SELF
to
fetch
instance
the
subtraction
is
made
division,
operation
of
the
subtraction
one
strongly
messages.
and
by
simply
in
a class
the
definition
affirmatively,
'b')
by:
we
add
the
expresses
becomes
value
is
an
the
next
(Grb~:.).
is
still
for
retrieves
every
can
be
the
the
immediate
returned
instance
value
The
active
has
the
multiplier.
is
the
is
the
because
object
sending
cascaded
definition.
of a class.
then
is
not
the
Smalltalk
more
we
following,
action
of
value
and
can
of
obtained
class
from
the
received
is
able
been
This
value
mul
tiplierj
value
returned.
send
messages
in a single
Message
can
easily
somewhat
actively
next
message
by
evaluating
number,
message.
is
to
look
completed).
activates
of b,
and
the
is
modelled
and
receive
to
rctul'llcd
message
streams
test
returning
receiver;
it
looks
This
a
number,
at
the
Upon
the
completes
result
on
stream,
are
the
value
redundant
some
the
next
for
and
in
turn
hence
message
seeing
second
the
of
the
the
notion
messages,
values
typed
in
the
it
or
to

THE
SMALLTALK WORLD AND ITS
PRIMITIVES
Page
47
«mod ~ ((G1='b
We
don't
wrong
The
user
3.
Class
class
object
investigate
Communication
'abc'+'def'
string
Here,
the
«+
In
other
reply
calculated
Communication
® go 100
4.
usually
action
=>
words,
bother
by
sending a message
error
handles
the
has
a way
is
string
(~b
+-:.
receive a value
somehow.
+-
:.)
error
to
printing
context
Object
'abc'
very
concatenation.
ft
'result
Object
is
number
~('non-numeric
do
this
of
the
similar
from
Again,
=>
(ft
as
it
is
which
it
the
specified
error.
Message
+'def'
to
number
of
concatenating
the
message
this
is
probably
Message
go 100
SELF
operand'))
much
doesn't
- b •
better
understand.
message
Reply
'abcdef'
for
SELF
and
done
Reply
SELF
I
b)
for
the
action
in a Small
receiving a message
and
b')
give
it
the
using
an
to
talk
Graphics
none
name
b.
escape
Graphics
draw a line
discover
sub-window
Action
and
then
Then
return
to
lower
Action
100
units
that a value
and
letting
doing
something.
to
the
levels
of
the
long
is
of
the
the
sender
system.
a
The
message
similar
messages.
« go
Comm u nica
to
the
~
(@="dist
to
second
---------------
do 4 do
5.
(@
go
50
turn
90.)
"Control
The g means
50
by
to
Structures"
@=>N
+-
turn
DO
(which
the
turtle)
allow
expressions
do a+b*5 ( ... )
:.
receive
to be
the
turtle
tion
GPexp
are
iterated
to
go 100
ex"ample. A
+-
:.
'Somehow
Object
--------
in
Small
talk
+-
g.
'method
the
message
actions
over
such
as:
turtle
work
for
"literally".
by
the
and
units
(100
actively
mall.e
turtle
Message
-------
4
(®
go
50
turn
90.)
the
same
doing
turtle),
over. We do
but
"dots"
returns
go
Reply
none
way.
exp
N
We use
rather
want
dist'
The
times'
it
on
the
display
itself,
thus
1t
SELF)
Graphics
------------------
draws a square
side
object
do
here
because
its
literal
form
to
calculate a value
screen)
permitting
Action
50
units
receives
we
don't
(which
is
with
long
its
want
is a
for
received
the
cascading
message:
the
request
the
repetition
in a manner
of
turtle
value
of ©
for
actions
number
go

TIlE
SMALLTALK WORLD AND
ITS
PRIMITIVES
Page
48
Communication
joe
6.
This
is a typical
method:
«grow
When
value
grow
received
Communication
---------------
joe
7.
jill
Here
we
hence
message
however,
separates
grow
50
message
=>
(SELF
Grsize +-size + :.
SELF
is
seen,
to
the
turn
25.
grow
30.
see a bunch
two
receiver
serve
will
the
Object
joe
undraw.
draw)
we
'undraw'
old
size,
Object
--------
joe
jill
of
send
message
be
able
syntactic
Message
grow
to a graphical
ourSELF
and
tell
Message
-------
turn
grow
messages
communications.
to
determine
purpose
of
50
object.
ourSELF
done
disambiguating
using
25
30
how
We
the
to
in
much
Reply
none
will
show
old
size,
'draw'
using
Reply
none
none
sequence.
In
many
of
the
Graphics
joe,
the
sides
by
box
is
displayed
both
the
compute
the
new
Graphics
------------------
one
box
then
another
The
period
cases,
the
end
the
message
of a
message.
Action
box, grows
50
units; a larger
receipt
the
size.
Action
on
screen
'.'
terminates a message
period
to
examine.
new
box
his
of
the
size
tilts
grows
is
not
message
by
25
30
needed,
The
and
its
adding a new
degrees,
units
period
as
does,
and
and
the
The
order
of
joe
turn
is
done
before
jill
grow
The
Notion
The
basic
class
1.
The
notion
2.
The
control
For
example, a send
and
resumed
object
sequence.
kind.
restarted.
The
structures
which
"Hepeats"
independent
communications
25.
30.
of
Class
definition
of
creating
of
the
flow
message
in
the
receiver. A reply
originally
"Conditional
of
various
state
or
control
structures.
is
deals
with
objects
of
evaluation
is a
sent
it
a message.
branching"
kinds
and
message
done
just
which
control
chooses
cause
sequentially
two
ideas:
have
independent
by
sending
action
suspends
Send
one
evaluation
properties
from
and
because
the
messages
path
to
to
happen
of
Small
left
to
existence
receiving
flow of
context
may
follow
over
talk
right
(as
and
messages
control
in
which
he orderc<l
from
many
and
make
it
with
memory.
in
is
it
in
depencling
over;
possible
English
various
suspended
is
found
time
they
may
to
text),
ways.
in
aIld
or
be
iIldifferent
on a test
be
terminated
construct
so:
the
sender
resumes
of
arbitrary
the
to
some
or

TI-IE
Here
word
formed
SMALLTALK
are
joe
in a dictionary;
Typically,
chapters,
to
each
retained
instance
definition
objects,
active.
some
is
the
the
class
instance
as
part
is
actively
and
one
for
of
the
abilities
name
of
object
has
definitions
of
the
of
the
doing
activation
each
class,
WORLD AND
which
have
an
object
each
value
have
class
description
of classes
that
entry
has
as a class
information
individually.
something
and
one
for
two
of
each
ITS
PRIMITIVES
alreapy
has
been
parts--the
or
as
known
Information
the
instance
(temporary
their
instances:
instance
been
created.
name
an
instance
locally
(instance
variables).
of
each
built
for
In
creating a Small
of
the
of a class.
t.o
the
known
variables)
Dictionaries
there
is a "global"
class,
you to use.
object
and
class
as a whole
locally
and
to
one
In
the
talk
the
value
As
explained
each
or
exists
exist
dictionary
for
each
table
object,
(class
instance
only
at
each
object
Page
below,
an
entry
of
the
object.
in
previous
variables)
is
when
level
known
currently
49
the
or
either
the
of
to
all
is
Message
joe b c
joe
@=>joe
@>(
a b
«grow
o
o
Form
...
J
Send
the
There
will
Send
the
value.
The
"hand",
of
the
refers
to
joe,
and
The
reply
look
«0
'not-false'
be
available
still
available.
The
reply
The
reply
Same
as g except
result
of
object
always
object
object
its
the
is
in
if
is
is
gathering
value
reply
the
the
the
Meaning
joe
the
be a reply
joe
an
empty
GJ-,
says
consider
joe. A literal
8S
8
class
is
the
literal
chain
the
message
the
token
grow
for
scrutiny.
value
of
next
literal
that
the
the
next
message b c.
of
some
message.
the
word
or
class
literal
word
(or
vector)
to
see
if
is
literally
Otherwise,
the
next
expression
token
in
current
token.
Any
message
kind.
Usually
next
token
is
simply a string
instance.
'joe',
(a
b
the
token
there
the
reply
the
message.
place
in
the
This
allows
can
the
reply
literally--i.e.,
Here
G?
...
).
(grow)
and
the
will
in
the
message.
message
the
receiver
of
is
is
next
be
be
literally
'false'
will
terminated
will
be
the
characters;
an
object
thing
and
be
retained
to
"peek"
with a period
just a reference
literal
word
an
object,
being
sent
there.
The
reply
in
the
message
whatever
reganUess
at
the
message.
'joe'
the
was
(.),
to
joe's
instead
however,
message
will
will
now
there
of
the
be
is
#
The
user
which
check
1l
3+4
a~(bJ
can
construct
the
class of
c~(dJ
...
The
reply
is a reference
the
message.
reference
name
other
the
r('ply
message.
if a evaluates
enclosing
continue
to
for
the
ways to
received
(t)
to
parentheses.
evaluation
So,
the
meaning
definition
object,
the
sender
to
for
example,
hp.
receive
and
the
'not-false'
Otherwise
after
to
the
of
hpj
lIenee,
messages
so
value
the
next
meaning
if
we
i.e.,
if
mentioning
on).
of
'3+4'
then
evaluate b and
evaluate
enclosing
(class
have
hp
from
which
or
class
G?func
is a class
func
these
is
7;
C;
if
it
parentheses.
instance)
f-
IIhp,
then
definition,
is
identical
primitives
the
7
continue
replies
'not-false',
Otherwise
of
then
to
(such
can
now
evaluation
...
the
next
the
value
func
mentioning
as
eXilll1i!1e
evaluate
expression
of
func
becomes
hp.
"receivers"
the
after
the
is
another
current
next
d
and
in
8

THE
The
SMALLTALK WORLD AND
conditional
"escape"
condition,
function:
message
iteration
received
from
enclose
they
parts
using
when
expression
the
'not-false'
the
delimit
to
disambiguate
repeat
the
symbol
a
branch I If
expression
the
'then-clause'
or
do;
in
g is
used.
~
(b)
in
or
general,
may
'(
order
ITS
be
used
you would
...
)'.
Parentheses
from
the
evaluation
they
group a sequence
PRIMITIVES
anywhere
like
the
to
rest
deliver
in
of a
of
the
in
Small
Smalltalk.
one
value
talk
serve a grouping
conditional
messagej
of words
Don't
or
another
expression;
they
group
together
forget
depending
or
they
expressions
as a
token
Page
50
about
the
on
delimiting
delimit
for
that
a
is
3+(a(b ~ {4}
will
evaluate
parentheses
limits
of
evaluation
to 7 or
is
used
the
'then-cluase'
include:
evaluating a or b but
letting
letting
evaluation
evaluation
of c depend
of c depend
repeat ( ... )
done
with
done
3 + 4
again
for
5}
8,
depending
to
order
not
both
The
The
Will
Will
Will
An
Contents
4
start
omitted,
the
for
the
on a or
on a and
contcnts
escape
will
cause
the
cause
the
restart
iteration
for i ..-2 to
of
each
time,
is
1;
the
on
the
values
evaluation
conditional
b
b
of
()
will
be
from
most
recent
most
recent
the
most
recent
control
feature
50
by 4 do ( ...
( )
will
be
exceeds
the
end
50.
'by'
part
condition
associated
of
the
st.atement.
a
~
(a
(a
be
re-executed
the
innermost
repeat-loop
repeat-loop
rcpeat-Ioop
included
)
re-executed
In
general,
may
be
value
message;
0 b
=>
()
b) ~ c
=>
(b)) ~ c
until a 'done'
loop
to
to
in
in
the
until
the
omitted
is
the
same
with a and
the
Some
examples
in
which
be
exited.
be
exited
which
the
basic
Small
the
value
'..-'
part
and
the
as
the
b.
innermost
of
is
encountered
the
'done'
with
the
again
talk
system.
of
index
may
be
default
start
index
Here
the
parentheses
conditionally
(or
is
enclosed.
value
7 as a
resides.
i.
starting
omitted
step
is
value.
and
1.
outermost
define
structured
if
you
hit
reply.
at 2 and
If
the
default
the
stepped
'to'
set
of
the
'ESC').
by
index
part
is
do
n(
... }
Objects
1.
2.
where
Other
are
Creating a class
to
(class
Creating
(if>
(name) ~ (value)!
(value)
available
created
name)
(
messages
an
instance
is
(basic)
in
either
The
contents
(i.e.,
for n ..-1 to n by
parentheses.
one
of two ways:
(temporary
and
responses)!
of a class
the
result
abilities
of
( )
will
be
re-executed
1).
variables) I (instance
of
activating a class
are
described
in
subsequent
The
counter N is
or
until
the
index
counter
not
available
variables) I (class
activating
an
instance.
sections.
N,
starting
as a
number
variables)
to
at
use
1,
inside
equals
n
the

THE
The
Small
by
typing
SMALLTALK WORLD AND
User
talk
~t
t
Task
has a USER
~
GET
print.!
USER
task
which
G?DO. !
is
evaluated
ITS
Get
Ask
PRIMITIVES
continually.
the
USER
task.
to
see
the
message.
You
can
see
the
message
that
Page
is
evaluated
51
In a Small
( cr.
The
task
(1)
(2)
(3)
(4)
(5)
Some
Comments.
window
the
item
Effect
sent
simply
print
whose
vector
longer
of
to
Smalltalk,
type a number
itself,
talk
system
read
eval
shown
above
prints a carriage
prints
the
until
the
<do
assembles
this
vector
token
eval,
whatever
is
always
returned
from
SELF).
The
name
is
is nil;
the
than
Message
the
hence
the
it
helps
number
that
does
print)
effectively:
return
Interim
it>
character
the
characters
is
then
it
evaluates
object
the
returned,
running
routine
disp.
Vectors
the
length
number
of
Print
to
or
an
arithmetic
will,
in
not
include
The
in
the
Smalltalk
Dynabook
prompt
(!)
into a list
an
object
vector
possibly
its
contents
that
returns
the
(activating) a class
read
expects
only
of a vector
message
and
understand
the
tokens
Period.
the'
expression,
fact,
print.
the
dialog
reply
is a vector. a request
c-haracter
is
typed,
we
call a vector;
receives
as a message;
can
receive
object
to
print
respond
correctly
containing
in
the
In
implications
Try
window
dialog
the
nil
(an
is
the
vector.
order
without
class,
window
(a.),
message
and
then
the
remaining
object
the
class
characters
to
the
Smalltalk
to
fully
of
the
print
explicitly
the
reply
to
evaluate a typed
(cr);
reads
characters
eval
print;
message
without
instance
typed
at
message
message
understand'
message.
telling
is
value).
(referred
the
eval
when
tokens
the
As
the
message.
from
after
seeing
print.
The
keyboard
the
("code")
results
an
example,
resulting
the
keyboard
(<()
Some
default
by
the
in a dialog
last
of
messages
number
object
object
name
item
is
if
the
in
one
you
to
3+4!
Now
try
(3+4)
3+4.!
(3+4)
This
meallS
will
be
resulting
which
and
the
If
you
the
following
sent
object
does
receipt
look
print!
print.!
that
any
the
does
nothing.
of
at
the
(code)
object
message
not
Unexpected
this
message
USER
vector:
Reply
Reply
Note
vector
message
The
next
hence
obtained
print
respond
task
in a Small
is
the
is
the
the
is a
print
number 7 sees
token
only
as a result
unless
to
the
results
was
not
number
number 7 printed
period.
Nothing
prriod;
is a
one 7 prints.
the
and
period;
t.he
does
the
original
message
might
occur
intended.
talk
system
printed.
twice
without
seems
to
happen.
period
retllrns
nothing.
message
the
of
evaluating a message
print,
with
print
period
message
Small
if
the
the
and
receives
is
talk
object
dialog
an
intermediate
The
last
message
itself
as
the
reply;
prints
itself
in
the
print
message
at
the
terminated
with a period.
runs a "dummy"
does
respond
window
class
space.
evaluated
it
the
dialog
(from
top-level
class
to
the
running,
t1H:11
the
print
in
receives
window;
USER
of
Small
named
message
you
the
If
print
will
code
the
the
task);
talk
the
see

THE
SMALLTALK WORLD AND
ITS
PRIMITIVES
Page
52
(sched
This
USER
that
object
each
of
response
evaluate
More
information
sched
and
Active
object
used.
be
This
the
return.
perhaps,
object
The
up
examine
values
passively
receives
that
that
Here
able
ability
message
can
method
arrow
actively
can
task
contains
which
to
the
window.
and
can
to
further
The
nil.
not
(1t) is
the
unless
the
receive
map
Gr(Grtask ~ vec[i].
assumes
should
the
message
message
Passive
receive
we
are
examine
to
let
sender.
former
That
further
of
active
this
rest
of
(hence
the
message
the
references
receive
(cr.
about
Return.
the
saying
an
object
There
is
object
examine
return
explicit
the
their
definition
eval
next
that
run
this
the
message.
there
to
the
is
to
read
eval
task
We
message
that
the
the
message.
further
are
default
is
returned
the
requires
request.
ability
includes
and
actively
message:
is
an
other
message
check
print).
is
provided
mentioned
print,
result
examine
two
methods
case--every
to
remaining
an
All
numbers
to
returns
print.
apply
task
t2 @=>(run)
object
named
objects
run
to
see
in
that
unless a message
of
evaluating a message
the
for
the
message
message,
explicit
The
form
return
cascade
1t
SELF
the
sched
(for
example,
each
time
if
there
the
Chapter V section
the
message
returning a value:
evaluation
if
request
is
1t
messages).
as a response
result.
(an
the
is
any
result
depends
results
sender.
any.
to
return
<value>;
actively;
By
Hence,
in
GLOB)I
instance
dialog
USER
keyboard
of
evaluating a message
terminator
is
on
Because
the
the
default,
to
the
windows
some
the
in
the
object.
<value>
class
each
result
of
the
task
is
input
entitled
(a
parenthesis
vahle,
method
passive
some
it
is
turtle
instances
message.
of
class
and/or
evaluated.
(1tbck)
Scheduling
an
object
used
return
object
returned
The
Small
is
an
returns
return
The
read
eval
obset),
font
The
and,
is a
or
that
to
return
and
whose
passively,
talk
object
its
themselves
class
is
and
that
windows),
usual
if
so,
to
Methods:
Small
talk
period)
an
value
that
might
it
to
active
is,
the
symbol
can
instance
is
vector
an
object

THE
The
definitions
interacting
applications
of
the
SMALLTALK
Form
for
with
of
each
class
are
messages
of
the
these
are
example, a version
box
(3=»
joe ~ box!
I'm a box:
joe is
?!
What
is
the
box
WORLD
Presentation
basic
Smalltalk
Smalltalk
classes.
created
annotated;
of
the
x
256
instance
anJ
class
y
type.
and
The
what
in
300
AND ITS
of
with
basic
happens
some
box
defined
size
Smalltalk
system:
the
Small
Small
when
cases,
in
The
name
Creating
50
tilt
PRIMITIVES
Classes
the
classes
talk
file
talk
classes
messages
the
actual
Chapter
of
an
0
the
class.
instance
II
of
already
system.
will
be
are
sent
definition
can
be
tho
class.
In
the
next
defined
for
Chapter V contains
presented
to a class
of
presented
the
by
instance.
class
as:
chapter,
general
showing
will
we
use,
examples
how
In
be
shown.
Page
present
aids
instances
most
53
for
of
cases,
For
joe
joe's
joe's
joe's
joe's
joe's
joe's
joe's
joe's
is
box!
box
x ~ 200!
200
x!
200
y
~
250!
250
Y!
250
size
100
size!
100
tilt
~
32
tilt!
32
~
32!
laO!
'Not-false'
Assigning
Querying
is
the
meaning
joe's
context.
same
in
as
joe's
'true'.
context.
joe
joe
joe
joe
joe
draw!
undraw!
grow
3+4!
turn
20*
move
100
2!
200!

THE
A b
brevia
In
order
We
a
expected
expected
expected
instance
expected
expected
forms
We
can
classes
is
is <
'S
's
SMALLTALK WORLD AND
tiona
to
present
Abbreviate
property
name
of
involving
further
will
respond
1
classname
print
<property> ~ <value>
<property>
these
of a class
value
(any
number
value
nonnegative
of a class
an
object
string
value
message
stream
[ ]
simplify
reasonably
>
examples a bit
instance
type)
integer
named
the
value
classname
presentation
to
the
ITS
PRIMITIVES
more
concisely,
of
classes
if
some
following messages:
replies
replies
prints
makes
replies
with
< classname>
in
standard
<property>
with
we
need
to
By
<property>
<value>
<number>
<integer>
<classname>
<name>
<text)
<message>
<selection>
class
conventions
<
classname
or
format
stand
<value>
of
adopt
some
>
false
for
the
<property>
abbreviations.
are
adopted,
<value>
such
Page
as:
54
all
Class
box
then
box
~joe
joe
joe
joe
joe
joe
~
box!
draw!
undraw!
grow
<number>!
turn < number>!
move <number>
can
be
described
<number)!
compactly
as:
Draws a square
angle
of
tilt = O.
joe
erases,
joe
erases,
joe
erases,
at
makes
turns
changes
x =
himself
himself
his
256,
y
bigger
by
<number>
coordinates,
300,
by
<number>
and
size
degrees
redraws
or
units,
each
and
side
and
redraws.
in a new
60,
redraws.
location.
and

THE
A
Link
class
pairs.
link
SMALLTALK WORLD AND ITS
Small
talk
is a
typically
definition.
Instances
init!
C;-pair +-link
pair
head!
john
Class
complete
It
is a
of
link
GT'john
Example
form
which
structure
receive
~mary.!
familiar
and
we
respond
S~t
up
Create
Ask
PRIMITIVES
present
to
LISP
to
the
following messages.
help
and
an
instance
for
the
value
as
an
users:
mail
whose
of
example
pairs
box
information.
~ame
instance
of
the
conventions
of
objects
is
pair
(or,
variable h (or,
which
as
in
as
LISP,
in
may
LISP,
for
presenting
in
turn
"cons").
the
"car").
Page
also
55
a
be
pair
tail!
mary
~triangle
triangle
triangle
f-
pair
print.
I Show
((
john.
is
1!
link
pair
lprtl
I
am a link.
I consist
The
form
of
the
to
link
a,l
h t I
(
<1+
=>
(1t
<lhead
<ltail
<llprt
=>
(1t
=>
(1t
=>
(helpprint
+
~
jim.!
mary) . jim)
of
(john.
class
definition
helpprint
link
SELF:
(<If-
=>
(<If-
=>
Ask for
Create
""'jim.
triangle
Provide
mary)
is
mailbox
)
(~hf-:.)
(((;=-tf-:.)
h))
t))
SELF)
the
another
the
value
is
some
value
an
of
instance
of
triangle.
instance
helpful
instance
information
variable t (or,
whose head is
of
what
class?
about
the
the
as
in
instance
instance
LISP,
pair
pair.
the
and
"cdr").
whose
tail
is
<[print
<ii,s
<['S
<linit
isnew:=>
to
hp
(~ob
cr.
=>
=>
(<i
=>
(ura
=>
(Grhelpprint
(Grh
ob
f-:.
disp f-'I
(dispf-'{'. h print.
link
=>
(1t
Grlin}l,)
f-
g.
1t
(<I
f-
=>
f-
# hp. GT'rnailbox
f-
:.
@-=>t
f-
:.))!
cr.
disp f-'I
consist
am a '.
of
'.
ob
dispf-'.'. t print.
<f
?
=>
('It
GTlink)
(a
f-:)
a
eval))
f-
(ob
is
?)
print.)!
'no
print.
dispf-')'.)
g.
1t(alse.)
mail'.)

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
56
Chapter
The
See
the
class
IV. BASIC SMALLTALK SYSTEM CLASSES AND
Basic
definitions.
end
System
of
Chapter
Atoms
Small
talk
atoms
entries.
the
atom
GFa If- atom <text
a
chars!
a If- <value>!
If
system
'b'
a
user
. '
WIll
force
are
unique
attempts
the
>!
Classes
III
for
tokens
to
two
to
an
explanation
which
create
be
the
an
same.
are
atom
The
Reply
Reply
The
(i.e.,
of
the
usually
which
value
is
is
<value>
this
method
associated
will
of a is
the
new
the
<text>
is
is
indirect
for
print
the
atom
name
of
names
associated
reference
presenting
with
Small
the
same
b.
which
prints
value.
with
the
to
UTILITIES
the
basic
talk
as
an
as
<text>.
name
b
the
name
Smalltalk
objects
already
b).
in
dictionary
created
system
atom,
a!
b!
eval!
a
= <name>!
a
b
<value>
<value>
The
value
The
value
Indirect
is
b,
Value
of a is
of
reference--a
and
the
of a if
b.
b is
<value>.
value
of b prints,
'not-false',
eval
is
the
'faIse'
value
of a which
which
is
otherwise.
<value>.

BASIC
SMALLTALK SYSTEM CLASSES AND
Arithmetic
UTILITIES
Page
57
There
are
two
interchangable.
(that
is,
in
the
10018.0!
12
100.018!
12.5
The
value
range
-32768
that
of
float
-99999.9999ge4095
An
integer
begin
addition,
beginning
with a digit
float
Good
123
-123
0.0
355.0
6.28e-23
classes
An
class
to
is
(where
may
operation
of
of
number
32767
from
be
Forms
for
handling
containing
the
object
is
the
form
to
99999.9999ge4095
with
the
digit
{O,
... ,
expressed
numerical
being
1.2e3
0 is
9).
in
scientific
both
sent
denotes
an
float
Bad
Forms
.0
355.
28e-23
operations:
classes
the
message).
1.2
times
octal
number;
must
notation
will
(10
have
an
as a product
number
and
have a reply
to
the
power
all
other
embedded
of a power
float.
in
the
3))
numbers
period,
They
class
are
numbers
of
10.
are
of
base
compatible
the
first
10.
float
must
not.
and
object
must
In
number
(/}='a
+-
128!
128
a + <number>!
a - <number>!
a
II<
<number)!
a I <number>!
a
wad
<
number)!
-
a!
a = <number>!
a * <number>!
Value
Reply
Reply
Reply
Reply
Heply
Reply
is
typed
Reply
Reply
of a is
is
the
is
the
is
the
is
the
is
the
is
the
holding
is
the
is
the
128, a number.
numeric
numeric
numeric
integer
integer
numeric
value
value
down
of a if
of a if
sum
difference
product
quotient
remainder.
negative
the
of
the
two
of
of
the
of
the
of
a.
<shift>
'not-false',
'not-false',
objects.
the
two
two
The
key
otherwise
otherwise
two
objects.
objects.
unary
and
objects.
minus
pressing
'false'.
'false'.
-.

BASIC SMALLTALK SYSTEM CLASSES AND
JReply
is a
if
a < <number>1
a
~
<number>!
'Reply is a
'not-false',
if
'not-Calse',
UTILITIES
'Calse'
otherwise.
'Calse'
otherwise.
Page
58.
a
> <number>1
a
~
<number>!
a 0 <number>!
aEJ(
number>!
alt] ( number> !
a[](number
a[)
( number> !
a min< number> I
a
max
< number>!
In
the
above, <number>
result.
float
~a
~
3.14159!
3.14159
@="a ~ float
a + <number>!
<number>!
>!
can
be
an
Reply is a
Reply
Reply
Reply is
Reply
instance
Reply
In
the
<number>
if
'not-Calse',
is a
if
'not-false',
is
the
bitwise
logical AND
logical
OR
logical XOR
LSHlFT
the
minimum
is
the
maximum
of
number
is
the
noating
following,
can
be
by
the
reply
an
'false'
'false'
logical
<number>
of
the
oC
the
or
of
point
is
the
instance
otherwise.
otherwise.
operation
two
values.
two
values.
float,
but
equivalent
proper
of
number
oC
the
the
of
the
noating
or
two
result
number.
point
oC
float.
values.
is
result,
the
proper
but
number
a - <number>!
a * <number>!
I <number>!
a
a!
-
a =
(number>!
a
;t!
(number>!
a ( <number>!
~
(number>!
a
a >
(number>!
a ~ <number>!
ipart!
a
Reply
not
be
E.g.,
is
in
27.3
the
integer
scientific
ipartl
part
notation.
Reply
oC
the
noating
is
27.
point
number;
can

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
59
a
(part!
a ipow (number>!
a epart «(loat>!
Reply is
not
be
in
E.g.,
27.3
Reply
is
Reply is X
E.g.,
27.0
Reply
is
This
is
used
the
fractional
scientiCic
fpartl
the
result
where
epart
3.0.
for
notation.
'Reply is
of a to
X ipow
3.01
printing
part
floating
of
the
3.
the
power
<float>
floating
<number>.
= a •
point
point
numbers.
number;
can

BASIC
SMALLTALK
SYSTEM
CLASSES. AND
UTILITIES
Page
60
Turtles
A
turtle
for
is a
Chapters I and
®
penup
is
equivalent
®
penup.
® goto
®
pendn!
However,
there
®'s
turtle
~®
~
turtle
GP®
~
turtle!
®
home!
® erase!
Drawing
method
II.
goto
to:
200300.
is no cascading
frame < dispframe>!
Turtles,
width
for drawing
like ®,
200
300
~
4. ® go 1
pendn!
after
DO!
on
can
the
receive
the
'8
display
any
screen.
number
message. A
Turtle's
Turtle's
Picks
of
range,
Erases
The
of
turtle's
range
range
up
pen,
faces
range.
class
turtle
was
cascaded messages.
width
can
vary
from 0 to
is
defined
is
the
takes ® to
upward.
entire
by
the
display
geometric
boundaries
introduced
For
example,
of
screen.
center
earlier
8 dots.
the
dispframe.
in
Say:
®
up!
®
penup!
®
pendn!
® black!
®
white!
®
xor!
®
go
(number>!
®
turn
(number>!
® goto (number>
© goto
®
®
(point>!
~
<text>!
~
(integer>!
(number>!
Faces
turtle
Any
travelling
Any
travelling
from
background.
Sets
ink
Sets
ink
Trail
exclusive-or-ed
Travels
Turns
clockwise
Travels
Travels
does
not
Prints
by
the
current
color.
to
to
in
current
to
x =
t.o
the
change
the
text
Ascii
location,
towards
.top
will
not
will
leave a trace
black.
white.
direction a distance
<number>
<number>,
place
represented
its
direction.
(or
the
code
<integer»
with
of
display
leave a trace.
with
other
degrees
y =
<number>.
character
at
its
direction,
screen.
if
ink
stuff
on
<number>.
from
by
the
represented
the
turtle's
width
is
different
screen,
current
point
and
direction.
and
if
width:
1.

BASIC
The
is a
SMALLTALK
False
method
for
false
@=>bool (-false!
bool
=>
(message»!
bool
or
(message>!
Class
handling
SYSTEM CLASSES AND
boolean
operations.
Since
evaluating.
.Reply
UTILITIES
bool is
'false' J gathers
is
result
of
evaluating
up
the
message
<message>.
without
Page
61
bool
and
bool (
bool =
bool >
'(message>!
(message>!
(message>!
(message>!
Evaluates
Evaluates
Evaluates
Evaluates
message;
message;
message;
message;
reply
reply
reply
reply
is
is
is
is
SELF.
SELF.
SELF.
SELF.

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
62
Sequential
include
Vectors
are
and
numbers
can
information.
information
save
separate
vector
G1="a
ara
the
and
both
organized
is 1
that
a vector
ranging
contain
space,
columns
f--
GT{this
(this
f--
vector < number>!
Dictionaries
classes:
Strings
like
may
from 0 to
any
Smalltalk
The
characters
which
Smalltalk
the
messages
only
is
a vector
isa
vector
vector,
beads
have
when
literal)
string,
obset,
on a string.
any
Smalltalk
255.
String
number),
you
type
shows you is
of
both
expected
literal)!
to
these
values
stream,
Their
objects
but
Small
object
are
talk
held
classes
and
file.
only
are
very
are
as
a
will
replies
difference
as a bead
thus
string
string
Gra
f--
'this
'this
@=oa +-string < number>!
first
be
is
not
useful
object
shown
differ.
a
string
is a
is
the
while
absolutely
as a compact
captured
belonging
together,
literal'!
string
literal'
way
string
as
a
they
respond
may
necessary
way
string
to
object
a
repeating
to:
only
contain
(since
to
store
and
dispframe
messages
vector
the
object.
whole
beads
textual
textual
To
in
the
a[<number>
a[
<number:lb> to <number:ub>
a <selection>
a < selection>
a < selection>
a <selection>
a (selection>
]!
f--
<value>!
f--
<value> <selection>!
f--
all
< value>!
find
first
find
first
<value>!
non
<value>1
]!
Objects
of
the
class
are
Reply
is
the
value
of
the
first
position
Reply
is a 'subvector'
starting
<number:ub>
[],
If
position
be a
<selection>
The
of
Copies
the
Reply
same
<selection>, 0 otherwise.
Similar
at
[<number>]
the
<selection>
<number>
string
form
the
same
the
sketching
is
as
to
is
1,
<number:lb>
(upper
and
is
of a single
becomes
of
beads
is
replaced
<value><selection>
class
as a
<value>
the
<value>
previous,
into
example
first
bead
if
except
created
with
the
bead
not
O.
or
'substring'
(lower
bound).
[<number:lb>
of
by
in
<value>.
the
the
is a
each
element
Chapter
position
a[
<number>]
elements
We
same
<value>.
initial
length
<number>.
found
at
position
of
beads
bou"nd)
and
call
either
to
<number:ub>], a <selection>.
element,
Otherwise,
class
method
in
the
II:
cobweb.
<number>
is
of
<value>
the
as a
for
found
<number>
whose
ending
of
the
value
of
<value>
and
of
obtaining a string
selection.
where
a[
in
are
ignored.
values
with
the
forms
the
bead
is
any
length.
This
was
<number>]
the
range
Note
are
copied
value
involving
found
expecled
of
beads
used
is
of
that
at
at
to
The
in
the
the

BASIC SMALLTALK SYSTEM CLASSES AND
Reply
is
t.he
a <selection>
find
last
<value>!
same as <value>
<selection>, 0
last. bead
otherwise.
UTILITIES
position
if
a[<number>]
<number>
is
where
found
a[<number>]
in
t.he
range
Page 63
is
t.he
of
the
a <selection>
a
eval!
a
lengthl
a + <vector>!
+ <string>1
a
a
map
<vector>!
a
= <string>!
find
last
non
<value>!
Similar
Vectors
current
Reply
Joins
copies
(string).
Vectors
the
beads
Strings
false.
to
previous,
only.
context;
is
the
only.
of
only.
Treats
last
number
of a and
The
a.
Reply
except.
the
item
of
bead
<vector>
value
is
<string>
elements
contents
of
vector
positions
«string»
of
<vector> is
of
as
must. be
if
a is
<value>
Smalltalk
nil.
into 8 new
sent
identical
are
ignored.
code.
Evaluation
vector
as a message
to
<string>;
to
each
otherwise
is
in
of

BASIC SMALLTALK SYSTEM CLASSES AND
Obsets
UTILITIES
Page
64
Obsets
(having
are
of
of
available
are
only
frequently
various
vector
position
"bushel
unique
used
kinds
and
provides a method
obset
C:V-ob ~ obset!
ob ~ <value>!
ob delete <value>!
ob
add
<value>!
unadd!
ob
ob
vec!
baskets"
as
are
in
values)
schedulers
all
contained
the
vector,
which
or
like
and
can
hold
"bags"
for
the
in
an
obset
for
automatically
removing
An
instance
If
the
same.
equivalence
Small
equivalent,
Assuming
obj
is
'false'
The
The
used
Reply
things
(being
objects
which
called
for you.
able
sched. An
expanding
objects.
of
obset
<value>
talk
if
<value>
most
to
is a vector
is
not
This
addition
of
the
objects,
as
their
there
is
there
arc
multiple
if
there
is no
is added
recently
implement a "stack".
containing
to
contain
they
is
given
already
values
large
pointers
only
occurrence.
whether
added
They
contain.
instance
the
the
in
method
in
ob.
integers
Bre
one
occurrence
occurrences,
or
<value>
all
the
can
be
duplicate
For
vector,
name
ob.
ob
it
will
(set
Since
of
the
not
equivalent.
only
not
one
will
objects
used
values).
example,
of obset
storing
be
union)
ob
actually
same
of
<value>.
the
already
be
deleted.
of
ob.
like
owns
added,
depends
value
first
exists
mathematical
Instances
the
display
its
own
objects
otherwise
contains
will
it
will
add
on
will
there.
and
in
checking
pointers
typically
be
be
deleted;
unadd
of
windows
instance
the
ob
stays
deleted
sets
obset
next
to
not
if
reply
can
the
for
the
be
in
be
ob
map
< vector>
An obset is
locally
used
message
bound
in
replying
run,
sched
where
object
vec[i]
each so
selted
Many
users
one
method
to
the
to
we would
map
G:J=>(vec
refers
that
map
G.i-"{
add
their
of
using
instance
the
message
say
[i]
to
the
ith
the
above message
each
run)!
own
version
of
map.
run)!
object
Evaluates
vector.
vectors.
the
obset.
Hence,
in
could
of
intersection,
Objects
The
the
be
the
vector
if
we
obset.
written
<vector> n
in
an
instance
wanted
It
is also
as
union,
and
times
obset
to
where
are
is
send
possible
so on,
n =
actually
named
every
to
to
the
the
number
stored
vec; i is
object
refer
in
to
definition
of
objects
in a vector
the
index
the
obset
each
object
of obset.
in
that
counter
sched
by
ob's
is
the
the

BASIC SMALLTALK SYSTEM CLASSES AND
Streams
UTILITIES
Page
65
Streams
are
similar
information. A pointer,
storable
stream.
~s
~s
~s
~s
Grs f-stream
S
f-
contents!
s
s
next!
item.
We use double
f-
stream!
f-
stream
f-
stream
f-
stream
<value>!
The
actual
of
vector < m>!
of
string
"of
vector (m>"
"of
string
to
the
i,
is
storage
quotes"
<m>!
(m>"
BCPL
kept
to
"from
"from
programming
to
the
method
indicate
(integerl
(integerl>"
current
is
either
optional
Create
Create
>"
"to
"to
Initially,
first
item
string
or
or
vector
other
than 0 (i=
actual
string
Stores
in
length
of
Returns
Returns
i.
language
stream
a
string
forms.
Default
10;
is
i=O;
storage
storage
(integer2>"!
(integer2>"1
s is
either a string
(i=O)
up
vector).
(m)
whose
or
vector
the
next
the
stream
the
stored
0
if
i=L;
method
item;
to
L=
Or,
<integerl> -1)
items
otherwise,
pointer L keeps
or
a vector
create
storage
10.
in a vector
in a string
or
to
the
last
optionally, s may
contents
(~i~i+1)
if
arc
length
(L = <integer2».
i=L.
(from
the
returns
for
bound
in a string
of
length
of
length
veclor
storable
referenced
up
item
of
first
the
storing
track
to
of
length
m; i=O; L=m.
m; i=O; L=m.
referenced
position
be a different
beginning
to
an
index
the
stream,
up
to
the
i+
lst
item
and
the
starling
(L=
length
with
other
expanding
ith
item).
and
retrieving
of
the
instance
before
of
length
string
an
than
increments
last
of
the
the
index
the
the
s reset!
send!
Resets i to 0 (points
Returns
'false'
'true'
if i is
to
the
the
end
beginning
of
the
of
the
stream
stream)
(i=L)j
otherwise
returns

BASIC
Files
The
Small
found
in a directory
Each
file
buffer
(sadr).
SMALLTALK
talk
file
system
by
its
has
in
its
local
Each
file also knows
SYSTEM
provides
file
name
CLASSES
for instanc.es
(fname).
context a character
the
directory
AND
of
A file
pointer
in
which
UTILITIES
the
class
name
(bytec)
it
directory
must
be
an
divided
instance
and a 512-character
can
be
found
(dirin.st).
into
of
files. A
the
class
string
as
Page
file
string.
an
66
is
ito
Initially,
Dynabook
disk.
Effectively,
omitted,
the
When
Small
default
there
is
equipped,
creating
this
name
are
sets
talk
(directory>
In
the
following,
Creating
~fi
~fi
File
~
<directory>
~
(directory>
Instances
G1="fi ~ (directory>
(directory>
file
(text>
Deleting a File
two
directories:
for
example,
a file
instance,
the
instance
runs
the
class
stored
as
defdir.
use!
"<directory>"
file
(text>
file
(text>
file
(text>!
exist!
file
is
therefore
old!
new!
dpO,
with
you
of
the
with
Unless
dpl.
However,
two
Diablo
actually
directory
curdir
specified,
optional.
only
model-31
send
a message
as
the
value
equal
to
nil,
defdir
Searches
directory;
Creates a new
the
First
creates a new
Answers
in
same
attempts
the
is
for
returns
name
the
directory?
dpO
should
disk
to
an
of
curdir.
indicating
defaulted
a file
previously
'false'
file
or
already
to
find
file.
question,
drives
instance
to
if
returns
exists.
an
old
does
be
used
or
with a Diablo
of
If
the
directory
that
the
dpO.
To
defined
not
found.
'false'
if a file
file;
if
the
rile
already
unless
the
class
directory
modify
in
the
with
it
fails,
exist
the
Interim
model-44
directory.
reference
should
this,
then
is
be
type
(directory>
file
Renaming a File
<
directory>
Loading
(directory>
(directory>
Interrogating
(
directory>
Reading
file
and
Saving
file
file
the
list
and
Writing a File
(text>
< text>
Entire
< text>
(text>
Directory
I
delete!
rename
Small
loadl
save!
< text> I
talk
Context
Deletes
Will
the
print
file
the
if
it
names
exists;
of
all
returns
the
files
'false'
on
otherwise.
the
directory.

BASIC SMALLTALK SYSTEM CLASSES AND
It
is possible
characters
context
local
to
on
even
for a file
read
character
and
write
instance
strings,
boundaries,
includes:
words,
or
characters
while a string
UTILITIES
from a file. A word is
is a set
of n characters.
In
simply
the
Page
67
two
following,
leader
curadr
nextp
sadr
by
numeh
pagen
snl,sn2
version
fi ~ (integer>!
fi ~ (text>!
fi
next!
fi
next
word!
fi
next
word ~ <number)!
fi
next
into
< text> I
fi
flush!
tee
disk
address
disk address
address
disk
character
512
character
number
512
current
unique
version
index
of
unless
page
2 word
number,
of
page 0
of
current
of
next
string
into
characters
current
page is
number
serial
currently
Store a number
Store
each
Read
the
Read
an
retrieve
Write
the
Read
enough
essentially,
for j to < text>
Write
out
page
page
sadr
on
the
number
character
next
character
integer
the
logical
number
characters
but
sadr
current
the
last
for
always 1
(Ascii
code).
in
from
next
into
not
identical
length
(the
i/o
page
the
the
from
fi
word.
the
from
do «
buffer)
page,
file
string
fi
(16
next
code
text>[j]
(8
bits).
word
fi
must
onto
to
as,
onto
bits).
of
fill
+-
ri.
be
ri.
Adjusts
ri.
the
fi
next)
character
string
<text>.
pointer
This
to
is
Addressing a
fi
skipnext
fi
end!
fi
shorten
fi
shorten
fi
print!
fi
reset!
fi
set
to
fi
set
to
fi
set <integer><number>!
File
<number>!
to
(integer)
to here!
write
<integcr><nwnber)!
read < integer>
(number>!
(number>!
Relatively
Same
as £i
Helurns
returns
Set
Same
Prints
S:lll1e as fi
Sets
go
Same
allocating
Same
'false'
nextp
as fi
the
byt.l'c to
beyond
as
as
positions a file.
set
to
read
file
instance
otherwise.
to
0,
pagen
shorten
file
set
the
write
new
set
name.
1 0
number;
end
but
pages.
to
read.
to
(point
of
pagen
if
to
current
pagen
file.
will
by
pagen,
integer,
file
to
beginning
to
stop
tee
bytec
by
location,
integer;
if
try
+ :.
lee
points
and
of
allocates
to go
numch
i.e.,
file).
beyond
to
the
to
pagcn
new
end
number.
bylec.
pngl's
the
of
end
the
file;
if
try
without
to

BASIC SMALLTALK SYSTEM CLASSES AND
Same
as
fi
set
the
directory
entry
the
to
referenced
current
fi
set
to
end!
Files
Open
A
list
of
file
open
list".
< directory>
< directory>
< directory>
List
and
print!
flush!
close!
directory
instances
currently
Prints
Write
Flush
being
out
the
UTILITIES
read
037777 0 (i.e.,
for
names
oC
each
state
oC
and
reset
each
open
each
the
forces
directory
Cile
file
in
filesopen
in
end
the
the
list.
of
file).
is
kept
directory.
Cilesopen
Page
in a "files
list.
68
Individual
< directory>
< directory>
Ii
remove!
Ii
close!
files
can
remember
forget
be
added
<value>!
<value>!
or
removed
from
Remove
Remove
current
the
files
file
file
page.
open
from
Crom
list.
the
the
Ciles open
files
open
list.
list
and
flush
the
bittable
and
the

BASIC
SMALLTALK
SYSTEM CLASSES AND
UTILITIES
Page
69
Dispframe:
Text
Small
musical
is
screen.
upper
string
gets
16,16;
as
Display
talk
notation,
to
create
They
left
or
creates
~df
you a rectangular
the
the
text
The
has a multiple-window
instances
are
corner
the
~
dispframe
width
buffer.
Gref ~ dispframe 3 100
gets
you a rectangular
buffer
dispframe
is a
string
by
stating
(Jpgf ~ dispframe 3 100
However,
characters
the
are
text
to
Basic Window Class
Routines
display
and
so
on,
to
be
created.
of
the
class
dispframe.
specified
vertical
instance
and
This
with
the
will
be
shown.
position
16
area
height
buffer
area
length
actual
not
with
by
256
on
are
50
at
50
show
five
y,
including
16
256
the
upper
256;
is
altered
200
upper
1.
The
text
of
200
because
capability
The
values:
an
which
main
These
upper
method
display
left
and a 'height. A fifth
the
words
string
string
400!
left
portion
and a string
by +-(store
of
the
of
400
characters)
' , !
left
instance
the
'hello
the
corner
frame,
variable
there'!
index
3,50
with a width
i.e.,
into
the
allows
viewports
for
creating
frames
corner
value
(integer>.
display
characters
and
last
is
set
text
string
are
horizontal
specifies
Hence
screen.
(whose
by
scrolling
of
100
to
O.
is
composed
and
editing
rectangular
position
either
The
local
in
and
It
is
last
=
0,
of
text,
windows
x, a width,
an
instance
upper
name
the
window.
height
possible
indicating
areas
left
is
buf)
of
to
pictures,
of
text
on
of
class
corner
serves
Or,
200.
create
that
the
an
is
The
a
no
There
are
scrolling
physical
than
the
Presently,
an
instance
the
class.
actually
are
done
display
physical
dimensions
of
dispframe.
winx
winwd
winy
winht
frmx
frmwd
frmy
frmht
buf
last
lstln
mark
charx
chary
two
on
screen.
display
entities
the
basis
The
screen.
defining
The
associated
of
window
frame
may
Frame
frame
and
following
window
window
window
window
to
frame
frame
fralile
frame
string
pointer
pointer
pointer
right x position
top y position
make
upper
width
upper
height
the
upper
width
upper
height
buffer
to
to
to
the
the
the
with a display
boundaries.
be
smaller
boundaries
window
are
left
left
(note,
window
left
corner
left
corner
current
character
character
of
of
the
boundaries
local
corner
corner
automatically
extend
la~t
the
character
character
are
bindings
x
y
x
y
in
in
frame: a frame
Window
or
larger
the
than
basis
are
(instance
increased
to
the
bottom
character
buf
buf
stored
that
begins
representing
pointed
pointed
and a window.
boundaries
the
window
for
word-wraparound.
given
the
variables)
on
creation
of
the
display
in
buf
the
last
the
last
to
by
index
to
by
index
last
same
line
prompt
last
are
intersected
and
values
for
of
the
screen)
of
text
output
Clipping
smaller
upon
each
instance
ill
the
with
or
larger
creating
instance
frame
and
the
of

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
70
The
text
Scrolling
window.
boundaries)
The
reply
are
meaningful
reply
justify
font
editor
buffer
occurs
In
this
is
stripped
variable
o
1
2
3
4
5
6
buf
when
case,
is
values
indicator
toggle
o
means
font
for
if
nil,
a
string
available
contains
an
out
useful
for
only
attempt
the
first
line
of
buf.
in
controlling
reply:
everything
and
no
intersection
no
intersection
window
frame
overflowed
both 4 and 5 occurred
display
height
height
is
and
bottom
for
frame
for
right
justifying
no
justification;· 1 means
displaying
then
default
defining
storage
the
for
characters
to
store
more
of
characters
window
okay--there
between
between
between
less
has
been
than
of
was
the
window
window
font
increased
window
and
window
characters
font
font
associating a unique
that
the
used;
to
can
control
contents
justify
otherwise,
be
used
be
displayed
characters
(where a line
and
frame
intersection
window
and
and
height
to
accommodate
(scrolling)
and
display
frame
so
not
between
the
(see
below)
of
the
on
frame
the
value
(see
below)
editor
causes
boundaries
window
frame.
even
one
text
new
text
window
boundaries
of
with
any
within
overflow
is
defined
and
line
font
is
display
the
window
of
the
according
scrolling.
can
be
displayed
frame.
bottom
The
boundaries.
of
the
to
frame
following
To
get a different
previously
created
t1rff ~ file
Then,
Or,
assuming
disp's
you
can
(~font
declare
@=>df ~ dispframe
@=>dl ~ dispframe
font
file
<text>
the
name
~
the
(integer>
(integer>
other
than
(see
section
intostring!
of
the
dispframe
If)!
font
at
the
< integer> <integer>
(integer>
on
same
(Jj=>df ~ dispframe < integer) < integer)
G.rdf ~ dispframe
Grdl ~ dispframe
Grdl ~ displrame
(integer) (integer)
(integer>
(integer>
<integer> <integer>
< integer> < integer>
the
default
Editfont
time
< integer>
(integer)
(integer)
font,
on
how
is
disp,
say
you
create
(integer>
(intega > string
Create
nn
boundaries
on
the
displilY
first
case,
because
to
the
df's
actually
(integer)
(integer)
Create
an
(integer>
(integer>
it
is
necessary
to
create
the
(text>!
instance
and
where a text
see
length
screen
variable
(GrJast
t.he
of
text.
(text>
string
instance
of
(text>
string
fonts).
instance
(integer>!
dispframe
of
the
with a hlack
string
last
is se:t to
f--
buf
length).
font
<integer)
dispframe
nolrame!
(integer>
to
read
the
Type
of
the
dispframe.
with
values
text
buffer.
double
has
been
specified,
O.
It
would
df
display.!
(fontstring)!
font
with
value
noframe!
font
string
for
window
The
window
line
around
it
will
be
necessary
(fontstring>!
for
Cont.
and
will
it.
not
from
appear
In
appear
to
type
a
frame
the

BASIC SMALLTALK SYSTEM CLASSES AND UTILITIES
Create
an
boundaries
black
line
instance
and
around
ofdispframe
length
it.
of
the
text
with
buffer.
values
for
Window
window
will
Page 71
and
frame
not
have
a
df ~ <text>!
df ~ (integer>!
df
show!
df
display!
df
frame!
df
frame
blac1t!
df
frame
white!
df
frame
color <
df
hasmouse!
df
fclear!
df
wclear!
df
clear!
df
scroll!
df
mfindc
(integer>
integer>!
<integer>!
Append
Append
character
Clears
Does a
Draws a double
Same
Draws a double
(color
denoted
Returns
otherwise
Clears
Clears
Does
cleaning
Removes
line
Find
Returns
If
If
the
this
if
the
show,
as
df
display
by
'not-false'
the
the
an
fclear
out
the
in
the
character
vector
vec[
vec[2]
vec[3]
vec[
vec[
1]=
vec[1]=-2
string
possible.
intersection
frame.
the
returns
intersection
intersection
the
frame.
1]
.j]
-1
Ascii
then
black
white
only)
integer
and
text
top
located
vee
then
then
<text>
to
character
of
window
draws
double
line
around
line
around
Draws
number.
if
the
'false'.
of
the
of
the
then
sets
buffer.
line
of
text
at
<integer>,<integer>.
such
that
subscript
left x of
width
top y of
position
position
buf
to
double
mouse
window
window
last
from
of
is
after
is
not
and
display
buf
and
black
the
window.
the
line
cursor
to 0 and
buf
of
character
character
character
character
the
in
the
and
display
frame
line
around
window.
around
and
frame.
and
the
and
in
end
of
window.
if
possible
and
the
is
physical
Istln
moves
in
string
string
string.
its
displays
the
window.
window
within
to
the
corresponding
buf.
in
color
the
frame;
display.
1,
effectively
text
up
one
df
df
mfindw
mfindt
(integer>
(integer>
(integer>!
(integer>!
Find
word
Returns
If
vcc[l]=-l
If
vec[2]=-2
Find
Hcturns
If
vec[l]=-l
If
vec[1]=-2
vector
vec[
vec[2]
vec[3]
vec[4]
token
veclor
vec[
vcc[2]
vec[3]
vec[
located
vec
1]
then
then
located
vee
1]
4]
then
then
at
<integer>,<integer>.
such
that
subscript
left x of
width
top y of
position
position
at
<intcger>,<integcr>.
such
that
token
are
delimiters
COllIlts
ldt
width
top y
position
position
of
word
of
word
word
is
after
is
not
count
considered
as
x of
token
of
token
of
token
after
is
not
in
do
one
end
in
first
end
the
where
not
tokC'n.
of
the
character
of
string.
window.
spaces
delimit.ers
increlllent
string
window.
or
in
and
not
word
carriage
but
the
count.
in
returns
multiple
<lext>
frame.

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
72
df
read!
df
reread
df
sub
df
hide!
df
put
df
corner (x>
df
moue to
df
growto
The
last
Small
talk
(integer>!
(value>!
(string>
(y>!
(X>
(x>
three
system.
at
(x)
(y>!
(y>!
messages
(y>!
are
added
to
dispframe
Makes a vector
dispframe
(Used
number
Evaluates
evaluate
window
Same as
Prints
Upper
Returns 0 if
returns 1 if
returns
returns 3 if
returns 4 if
Set
Set
«y)-frmy).
by
the
left
winx
winwd
when
is
fix
of
prompts
<value>
the
within
df
felear.
text
corner
2
if
and
disp.
editor
position
position
position
position
position
and
the
out
and
the
<string>
of
frmx
frmwd
window
of
redo).
in
the
in
the
within
window).
df
frame
starting
df
becomes
x,y
x,y
x,y
x,y
x,y
to
<x>;
to
keyboard
Counts
buffer
context
in
in
in
in
in
input.
back
and
of
the
window
white.
at
x,y.
no
corner
upper
lelt
upper
right
lower
left
lower
right
set
winy
«x> -frmx);
framework
from
does
the
and
position
corner
corner
corner
corner
and
frmy
is
Assumes
cnd
of
II
read
from
dispframe.
by
shirt-esc
x,y.
to
<y).
set
winht
included
the
buf
(Used
name
an
there.
to
llnd
in
of
<integer>
by
fix
create
frmht
the
basic
the
to
a
to
Four
dclear
dcomp
dmove
routines
(integer> (integer> (integer> (integer>
(integer> (integer> (integer>
(integer)
are
available
will
clear
the
specifies:<upper
is
then
filled
number
all
will
specifies:
given
black.
complement
<upper
(integer)
will
take
the
above),
upper
source
dots
0; 0
and
left
rectangular
in
the
or
1 =
move
corner
source
1; 1 or
for
manipulating
rectangular
left
corner
with
black
(l's = black,
the
rectangular
left
corner
(integer)
source
rectangular
it
to
the
x,y).
area
will
rectangle
0 =
1; 1 or
rectangular
area
x>
<width>
and
white
O's =
white).
(integer>!
x>
<width>
(integer)
destination
The
seventh
be
stored
will
he
1 =
1).
dmouec (integer> (integer> (integer> (integer>
same
as
dmove
except
that
the
non-intersecting
(number>
defined
<upper
dots
For
area
defined
<upper
(integer)
area
defined
defined
integer
as
given;
'or-ed'
(integer>
areas
I
by
the
left
according
example,
by
left
(integer)
by
by
the
is a
if
with
the
(integer>
source
of
the
corner
to
the
corner
the
mode
the
dots
if
fifth
display.
four
integers,
y>
the
binary
the
number
four
y>
<height>.
(integer)!
first
four
and
indicator:
mode
is
in
the
(integer>!
rectangular
<height>.
representation
is
integers,
integers
sixth
illt('Gers
if
not
0,
destination
area
where
-1,
the
the
is
The
the
where
(same
mode
black
area
cleared.
the
order
cleared
area
the
of
will
order
area
the
order
(destination
is 0,
the
and
white
(0
or
° =
be
as

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
73
Point
A
Chapter
point
Class
is
an
II
section
point
Gt-"pt f-point
pt
x!
100
pt
y!
200
pt
+ <
point>!
pt
- <
point>!
pt
= <point>!
pt ~ <point>!
pt
max
<point>!
example
on
100
2001
of a
storage
sketching
method.
ideas.
Create a point
Reply
is
point
Reply
is
point
Reply
is
pt
y
Reply
is
pt
equal
to
those
Reply
is a
<poinO;
similarly
Several
whose
obtained
obtained
if
they
y
if
pt
of < point>.
point
whose
horizontal
are
is a
for
the
examples
by
adding
by
subtracting
the
same
point
whose
horizontal
vertical
of
its
coordinate
coordinates
coordinates
points,
horizontal
position
position.
use
have
is
100
of
pt
otherwise
and
is
the
and
and
of
false.
vertical
already
vertical
<point>.
pt
and
maximum
been
coordinate
<point>.
positions
of
given
are
that
is
200.
smaller
for
in
pt
the
or
and
pt
min
This
Also
< point> !
class
to
point
(isnew
provided
to
is
<l
<l
<l
<l
<l
<l
<l
<l
<I'
mp
provided
a I x y
=>
x
=>
y
=>
+
=>
(GFa
-
=>
=
=>
~
=>
max
min
print
in
('It
partly
(~x
f-
(<If-
=>
(~Xf-:.)
(<l
f-
=>
(ur
f-:.
(G¥>af-:.
(((ff>af-:)
((@=>af-:)
=>
((ff>af-:.
=>
(GrUf-:.
=>
(Grpoint
the
basic
point
mx
Reply
<poinO;
at
the
:.
(ff'
y
yf-:.)
'It
point x+a x
1t
point
=>
(1t
=>
('It
'It
point
'It
point
print.
Small
my)!
is a
point
similarly
machine
f-
:.)
'It
x)
'It
y)
y+a
x - a x y - a
false)
talk
false)
(x
(x
sp. x
x = a x
x a x
max a x)
min a x)
print.
system
code
y)
is
whose
for
y)
=>
~
sp. y
the
the
level.
('lty
('It
(y
(y
routine
horizontal
vertical
The
= a
y)
yay)
max a y))
min
a
print))!
mp
position
position.
corresponding
'It
false)
'It
false)
y))
is
the
code is
minimum
equivalent
of
that
for
to
pt
and

BASIC SMALLTALK SYSTEM CLASSES AND
UTILITIES
Page
74
Aids for
The
Interacting
Small
talk
edit < classname
will
get
fix
< integer> I
where
where
edited
edit
< classname>
will
start
The
editor
hand
of
parenthezation
do
4
(®
is
shown
Class
>!
you
the
Small
integer
you
transaction
frame
is
the
are,
will
title!
the
editing
shows
contains a structured
go
100
turn
as
with
Smalltalk
Editor
talk
editor
number
get
you
will
be
evaluated,
with
the
two
frames.
are
shown. A lower
90)
for
of
transactions
the
Smalltalk
title
line.
The
righthand
representation
the
but
level
class
editor
the
of
which
is
named
(images
for
transaction
original
frame
parentheses
transaction
contains a menu
of
the
<c1assname>.
of
the
Interim
definition.
is
shown
Dynabook)
integer.
will
not
of
All
tokens
as
O.
Upon
exiting,
be
modified.
commands,
at a single
An
example
back
the
from
the
left
level
is:
In
the
following,
Commands
Add
Insert
Replace
Delete
Move
Up
Push
Enter
Leave
Exit
do
4
All
editing
cursor
()
and
is
dOone
pushing
"text"
refers
Number
Grabbing
0
1
2
2
3
1
2
1
0
0
by
"grabbing" a command
the
top
or
middle
to
of
Times
Needed
characters
typed
Append
Add
text
Replace
beginning
Delete
beginning
Combination
text
before
Remove
Put
parentheses
to
the
beginning
See
the
See
the
Terminate
mouse
text
the
the
parentheses.
next
next
from
Action
to
before
text
and
text
and
of
the
lower
higher
editing.
button).
end
designated
end
indicated
end
deleting
word
in
the
the
keyboard
Taken
of
current
indicated
words
words.
pointed
around
and
end
level.
level.
righthand
level.
word.
by
pointing
with
new
by
pointing
text
and
to
words
indicated
of
the
menu
and.
terminated
text.
to
inserting
as
third
intended
(pointing
to
the
the
new
'grab'.
by
pointing
grouping.
with
to
!.
it
with
the

BASIC SMALLTALK SYSTEM CLASSES AND
The
only
level,
exceptions
no
grabbing
are
is
required.
Enter
and
Up.
If
there
is
only
UTILITIES
one
level
marker,
(),
showing
in
the
Page
current
75
Showing
show
< name> !
defs!
dpO
list!
type
<text>!
Saving
filin
<text>!
filout
< text> !
Stored
will
show
will
show
will
show you
will
show
Snlalltalk
will
go
to a file
Example:
filin
'boxes'!
Usually
the
Information
you
what
you
the
names
the
names
you
the
contents
Definitions
whose
file
will
meaning
of
of
name
contain
the
<name>
classes
ril~s
stored
of
rile
named
is
<text)
programs
you
currently
have
on
your
<text>;
and
written
defined
disk
returns
tell
Small
there
has.
that
pack.
by
are
'false'
talk
to
running
currently
if
the
read
what
filout
available.
file
does
it
finds
as
defined
not
next.
exist.
on
the
file.
fHout
will
fHout
will
variations
(text>
will
filout
will
Suppose
filout
will
(addto
write
every
'boxes'!
write
(vector>!
ignore
'boxes'
ignore
the
'boxes.'
G.r(boxcs
write
out
turtle
out
of
filout.
defs
@='(box
defs
vector
square
the
(<(place
program
every
and
and
contains
programs
whose
program
only
write
square
only
write
(addto
=>
(SELF
name
whose
out
triangle)!
out
vectors,
turtle
boxes
and
penup
is
in
defs
name
is
the
programs
the
three
for
example,
G.r(<[place
square,
goto
to a file
currently
mentioned
programs
=>
(SELF
and
then
(:)(:)
called
in
whose
penup
the
pendn
defs.
in
names
vector
up))).
<text>.
There
the
vector.
appear
goto
Example:
are
(:)(:)
a few
other
Example:
in
the
pendn
useful
vector.
up))))!

BASIC SMALLTALK SYSTEM CLASSES AND
On
filing
in
this
file,
the
filout
filout
filout
pretty
pretty
will
(text>
will
Obvious
filout
fUout
filout
The
(text>
(text>
format
add!
not
overwrite
variations
pretty
< text>
pretty
(vector>
I
(vector>1
the
programs
(text>
add
< text>
could
ability
so
file
<text>
include
addl
< vector> I
add
(vector>!
be
given a name
they
but
to
receive
will
instead
such
print
the
nicely
will
as
message
add
Hst:
UTILITIES
place
will
(in
show
format).
the
new
definitions
be
added
at
to
the
the
end
class
of
Page
turtle.
<text>.
76
fHout
Or
filout
Saving
file
< text>
~list~
and
then
<text>
list!
will
write
< text>
G1-"'list!
will
first
named
and
savel
will save
Example:
file
'blockworld.sv'
Try
<vector>!
it
is
possible
out
the
write
out
in
list.
Variations
Restoring
your
entire
to
type
definitions
the
definition
with
Your
current
save!
of
objects
of
pretty
Context
state
verbatim
named
the
and
in
vector
add
are
on
the
list.
list
also
file
and
then
possible.
<text>.
the
definitions
of
the
objects
file
file'dmt.boot'
to
(text>
will
file
This
start
the
Interim
load!
restore
'blockworld.sv'
file is also
you
load!
to
one
Dynabook
the
exact
load!
that
you
memory
state
can
when
resume
diagnostic.
the
file
from
the
<text>
operating
was saved.
system.
Example:
That
is:

BASIC SMALLTALK SYSTEM CLASSES AND
resume blockword.sv <return>
will
Utilities
are
already
mouse,
nil
restore
written
telling
you
you
to
programs
how
much
the
exact
which
room
state
provide
is
available,
when
useful
the
and
file
services
so
forth.
UTILITIES
was
saved.
such
as
reading
the
keyboard
Page
and
77
the
stands
null
<value>!
which
core!
will
tell
your
space
I've
run
say:
expand
This
at
the
expand
will
increase
addto
<classname> <vector>!
will add a
for
the
will
reply 1 if
you
gets
out
< number>!
will
remove
rate
of
lOa!
definition
empty
how
that
of
memory
32
your
value
the
many
low,
<number>
words of
workspace
whose
in
Small
<value>
words
or
(worse)
of
space
by
meaning
is
are
scan
per
3200
talk.
nil
It
may
(i.e.,
the
left.
Any
you
get a diagnostic
lines
from
scan
line.
words.
is <vector>
be
empty
reply
the
So:
to
tested
value),
smaller
screen
the
class
by
saying:
than
window
and
whose
and
'false'
500
with
convert
name
otherwise.
is
courting
the
message:
them
is
<classnarne>.
to
disaster.
usable
If
space
Example,
addto
box
{ <value> <value> ... <value>
will
stringor
<value>!
will
responds
after
typing:
box
G7'(<(move
\\'ill
know
how
construct a vector
convert
to
the
the
<value>
message
base8 <integer>!
to
=>
move.
}!
of
(SELF
the
into
print.
redraw
values
an
instance
(({}=x~:.
found
between
of
the
@"y~:.)))!
the
curly
brackets.
class
string
only
if
<value
is
an
object
that

BASIC SMALLTALK SYSTEM CLASSES AND
will
<integer>.
eq
<value> <value>!
construct
an
instance
of
class
string
containing
UTILITIES
the
octal
representation
Page
(unsigned)
78
of
Keyboard
<return>
<bs>
Reading
kbd
TTY
Small
talk
buffer
use:
waiting
compares
Keys
moves
following
removes
the
Keyboard
will
wait
character
standard
To
receive
which
will
will
not
for a
two
Smalltalk
text
to a new
any
previous
until a character
which
codes
to
an
uninterpreted
wait
lose
typed
program
was
the
for a
character
typed
character.
character
characters
to
pointers.
version
use
TTY
line
(including
has
been
after
to
be
if
no
or
when
typing
<return».
typed
and
being
kbd.
passed
of a character.
typed
and
program
To
is
find
in.
Will
otherwise
then
reply
through a table
use:
then
reply
with
listening.
out
if
Instead
there
are
with
an
any
be
ignored.
the
numeric
which
uninterpreted
they
assigns
are
held
characters
code
(basically)
result.
in
an
in
the
of
the
ordered
buffer.
kbck
read
read
which
would be:
kbck
which
character
will
Everything
of
(text>
is
the
replies
=>
(Grchar .-kbd)
will only
in
gather
you
the
same
keyboard.
'not-false'
use
char.
up a
type
as
read
kbd
vector
until
except
if
characters
if
there
of
Small
a ! will
that
have
been
is
already a character
talk
code.
It
then
be
made
the
characters
typed
first
into
are
and
'false'
waiting,
sends a prompt
a
vector
which
found
in
<text>
otherwise.
and
will
is
sent
rather
then
n
to
back.
than
A
typical
save
the
taken
use
the
new
display.
from

BASIC SMALLTALK SYSTEM CLASSES AND
evl
UTILITIES
Page
79
repeatedly
of
Smalltalk
to ev
(repeat
Over
and
over,
terminated
vector,
back
done!
will
evaluation:
~
to
and,
to
the
or
terminate
level 4-
ev
(~level
repeat
(cr.
GT'level ~ level -
Notice
that
CiT
a ~ read
(/)" a ~ a
a
print!
evaluates
evaluation.
(cr.
it
by
a !,
finally,
user.
The
<ctrl>D
it.
11
4- level +
~level
if
the
of
eval!
the
vector
read
eval
will do a
send
the
give
the
loop is
Here
1.
print.
1.)1
last
token
'.'.
(cr
print))
carriage
resulting
result
infinite
is a
fancier
sp. level
in
the
8 is
(.)
8
evaluates
nil
prints
read eval
I
return,
vector
of
evaluation
but:
version
print.
message
to
nil.
as
nothing
print);
put
out a prompt
the
message
the
which
sp. read
is a
period,
will,
eval
message
will
eval
print)
then
in
to
print
tell
the
effect,
give
character
get
Small
in
order
you
sequence
the
you
A,
talk
to
current
is
not
another
wait
to
execute
show
unlike
for
the
level
level
input
the
reply
of
< shift>
<ctrl> (
Transferring
apply
<esc>
creates a subwindow
window.
done!
Subwindows
than
main
example,
does
you
expression
<name>
will
the
number
(In
or
the
font
windowj a
in
an
evaluation
an
opportunity
being
Messages
send
the
object
of
which
things
effect,
< ctrl> D
can
be
height.
return
the
middle
typed.
current
has
in
the
dialog
evaluates
nested
When a subwindow
of
of
the
to
message
name
we
can
ev
as
long
to
the
main
typing
next
expression
perform a computation
(the
<name>.
do.
Somebody
window. Allows
in
the
subwindow).
as
there
is
window
some
expression.
at
one
which
For
example,
sends
is
space
created,
returns
the
and
was
us
the
Small
To
return
to
create a window
reading
you
to
time
the
have
sent
to
the
suppose
message:
talk
evaluation
to
main
characters
the
precise
keyboard
the
result
context
'we'
are
window,
place
input
be
we
called
as
with
height
is
suspended
you
is
read.
used
are
currently
'bogus'
in
type
left
in
the
This
the
and
dialog
greater
in
the
off,
for
gives
main
in)
to
have
a

BASIC SMALLTALK SYSTEM CLASSES AND
bogus sq 100+501
and
we
have a line:
UTILITIES
Page
80
</sq ~ (apply
then
the
apply
<name> to <vector>
gets
apply
will
we
apply
<name>
will
vector
using
apply
apply
<name> to <vector>
is
evapply
square)
square will
value
150
and
the
object
which
square to @=>(150)1
draw
the
square
can
compute a message
in
<value>
send
the
current
starts
with
only
"top
level"
the
mumble
fullblown
in
apply.
be
applied
draw
has
with
message
context
names
GLOB!
in
<value>
the
square
name
sides
and
<value>.
to
the
remainder
with
<name>
150
then
to
the
(ignoring
sides
units
send
object
For
the
150
and
sends
long.
it
to
which
example,
dynamic
of
our
units
it
the
The
Small
talk.
has
if
environment),
message
long.
message
important
name
<name>
you
would
100+50
<vector>.
thing
like
then
so
here,
using
to
evaluate
try:
that
it
can
Example:
of
course,
dictionaries
the
pick
up
is
that
whose
message
Display
disp
indisp
has
exactly
be
evaluated
evapply
will
reply
depending
The
optional
Utili
ties
is
the
mouse
things
disp's
will
tell
the
(a<b
with
on
local
name
activates
about
frmx!
you
same
rather
=>
the
formats
it.
the x position
<value> <message>1
meaning
than a <name>.
('abcdefg'
the
values
of
the
)Gr(
length
of a
for
evapply
any
dialog
window,
as
of
either
and
disp
(upper
apply
Example:
this
is
the
b.
are
the
window.
may
left
except
vector))
that
to @=>(length)!
string , abcdef
same
as
It
is
an
be
used to
corner)
of
it
expects a (message>
g',
or
the
for
apply
as
described
instance
send
the
messages
frame.
of
the
vector
class
to
the
of
(3=»(
this
above.
dispframe.
window
some
is
or
to
kind
vector),
When
find
to
the
out

BASIC SMALLTALK SYSTEM CLASSES AND
will
sp
cr
dsoff
dson
temporarily
This
is
usually
they
will
to
indisp
(~disp
1t g eval)
will
print a space
will
print a carriage
turns
off
turns
the
be
disp
the
display
redefine
used
using a dispframe
f-
:.
when
disp
the
!
character.
return.
display
on
and
again.
speeds
to
be
message
named
up
Small
<value>
contains
disp.
talk
and
The
by a factor
UTILITIES
evaluate
print
or
routine
is
of
the
message
read
defined
2.
routines
as
in
which
this
new
assume
Page
81
context.
that
redo (integer>
where
where
Control
repeat
Utilities
( ... )
contents
key).
done
will
cause
done
with
<value>
will
again
will
for
<atom> +-(nwnbcrl)
an
iteration
<atom>,
<integer>
you
of 0 will
The
cause
restart
starting
are,
escape
the
loop
the
loop
the
control
is
the
will
re-evaluate
be
will
be
to
be
to
be
innermost
to
(numbcr2>
feature--will
at
<number1>
number
re-evaluated
exited.
exited
from
loop
of
the
the
with
in
by
and
transactions
message
until
innermost
the
value
which
thc
(nwnbcr3>
re-evaluate
stepped
(images
at
transaction
a done is
loop
in
<value>.
again
resides.
do
()
contcnts
by
<number3>
of
the
<integer>.
encountered
which
the
of
()
each
Interim
(or
done
until
time,
Dynabook)
you
is
enclosed.
the
value
exceeds
back
strike
the
of
<number2>.
the
from
escape
index
if
(value>
then
< message
1>
else
(message2
>

BASIC SMALLTALK SYSTEM CLASSES AND
if
the
value
of
<message2>.
do
<integer> ( •.. )
the
contents
<value> is
Otherwise,
of ( ) will
be
'not-false',
evaluate
re-executed
then
<message2>,
<integer>
ignoring
UTILITIES
evaluate
times.
<message 1 >
<message1>.
and
do
not
Page
82
evaluate
Mouse
mx
my
mp
button
Utilities
replies
margin.
replies
absolute
replies
<numeric
tests
the
button
button
button
button
button
button
button
button
with
with
bottom,
with
value
mouse
0
1
2
3
4
5
6
7
the
horizontal
the
vertical
512
at
an
instance
between 0 and
buttons
'not-Ialse'
'not-Ialse'
'not-Ialse'
'not-Ialse'
'not-Ialse'
'not-Ialse'
'not-Ialse'
'not-Ialse'
position
position
the
top
of
class
7 >
singly
il
no
if
middle
if
bottom
if
bottom
if
top
il
top
if
top
if
all
and
point
and
buttons
button
button
and
button
and
middle
and
middle
the
buttons
of
the
of
the
6BO
such
in
combination.
are
on
is
is
middle
is
on
button
are
are
mouse.
mouse.
at
the
that
on
(top
on
are
on
are
on
on
0 is
0 is
at
bottom
mx = mp
is
button
on
at
the
of
the
x,
nearest
the
left
top
of
original
my = mp
wire)
margin,
the
screen,
dialog
y.
512
is
BOB
window.
the
is
right
at
the
mem
mem
clock
mem
mem
mouse
mem
mem
mem.
mem
loads
integers
0430
0430
+-
0424
0425
0424
+-
0425 +-0
from
and
stores
them
into
real
core.
The
important
Read
the
clock
0
0
Set
Read
Read
Reset
Reset
the
clock to zero
mouse
mouse
mouse
mouse
x
y
x
y
locations
are:

BASIC SMALLTALK SYSTEM CLASSES AND
cursor
mem
for i
mem
mem
mem
0431
~
1 to
16
0105
0105 ~ 0
0426 ~ x.
(mem
mem
0430
0427
+ i
~
~
y.
shape[i])
for
i
...
1
Put
new
bits
Connections
Disconnect
the
Move
to
16
into
between
cursor
cursor
UTILITIES
(mem
0430
+
cursor
from
mouse
and
from mouse
i)
are
vector
cursor
the
cursor
named
bits
shape
Page
83
interrupt
mem
0107 ~ 0177
display
mem
control
0420
keyboard,
mem
0177034
mem
0177030
character
block
keyset,
and
mouse
inputs
Make DEL
Get
pointer
Reads
the
Reads
the
the
interrupt
to
display
first
of 4 keyboard
word
with
character
control
mouse
and
block
input
keyset
(instead
words
bits.
of
ESC)

EXAMPLE
SMALLTALK CLASS
DEFINITIONS
Page
84
Chapter
This
chapter
Included
definitions.
in a "try
Arithmetic
Example:
The
payments.
years
computation:
Let
Let
Then
are
it
problem
to
payoff
rate = interest
increase
each
monthly
V.
EXAMPLE SMALLTALK CLASS DEFINITIONS
provides
samples
The
out"
Figuring
we
The
some
examples
of
programming
examples
style
chose
main
the
=
(1
with
the
to
demonstrate
routine
loan,
ratel
+
rate)
correspond
suggestions
Amortization
payment
and
the
(100
raised
*
payment = (amount
of
techniques
on
the
number
*
number
to
the
number
of
the
use
of
various
as
to
the
basic
classes
problems
of
use
requests
of
of
power
of
the
loan * rate * increase) I (increase
and
Loans
of
float
values
payments
payments
(number
payments
well
projects.
is
for
per
per
Small
as
the
defined
the
amortization
the
loan
per
year.
year).
of
years
year).
talk
contruction
in
principal,
to
basic
Chapter
It
then
payoff
system
of
new,
IV;
of a loan
loan
carries
the
loan
-
1).
classes
interesting
they
in
interest,
out
and
are
equal
the
utilities.
class
presented
monthly
number
following
of
The
To
report
and
expect
The
Small
Next
rate,
read
will
you
type
saying:
total
the
report'
Interest
talk
to
report
(cr.
disp ~ :.
(:)
we
need
etc.
We
gather
until
amount
(number
results
Interest
to
see
Rate
definition
print)!
to be
can
up
a ! will
paid
over
the
period
of
years
to
payoff
of
the
calculations,
Rate
as a
Percentage
as a Percentage is 54.
is
able
to
use
a
the
vector
then
receive
Small
of
talk
Small
be
made
the
utility
talk
=
the
loan * number
we
need a reporting
is
'
rate!
Print a carriage
Print
Print
values
from
reacl.
tokens.
into
a
vector
the
tile
It
of
return.
textual
message
value
rcet'ivcd
the
keyboard
first
sends a prompt
which
payments
routine
in
in
t.he
for
is
sent
per
where
the
dispframe.
dispframe.
the
back.
Jl
year) * monthly
we
might
parameters:
to
the
For
number
display.
example,
say.
payment.
of
Everything
the
result
years,
of
GT-a ~ read!

EXAMPLE SMALLTALK CLASS
and
then
typing:
do
4
(®
go
100
turn
90)!
will
the
If
you
associate
a!
following
(do
send
a
4
eval!
the
literal
will
be
(@
go 100
the
message eval
the
vector
reply:
turn
(do
90))
to
a,
4
(®
Small
DEFINITIONS
go
100
turn
talk
will
evaluate
90))
with
its
contents:
the
name
a.
If
we
say:
Page
85
and a square
a[2J!
4
To
select
the
a[3][4]!
turn
Vectors
read
from
have
of
(text> is
the
to
keyboard.
demand
(GFnm
(<las
1tnm ~ read
Try
it
with:
demand
1
want a new
Then
type:
spd!
367
will
be
fourth
many
capabilities.
the
nm
~
8.
=>
(disp~:)
spd
as ' 1
drawn.
element
same
To
help
eval)!
want a new
speed
&1367!
To
as
get
nm
select
of
read
the
third
To
see
except
values
print)
the
more,
from
speed'
second
element:
take
that
the
the
!
element
a look
characters
keyboard,
of
at
the
the
you
vector
definition
are
found
might
define:
a:
of vector
in
<text>
in
Chapter
rather
than
IV.
taken
or,
without a specific
demand
angle
D,,59!
angle!
59
We
will
also
notation.
the
nearest
We
dollar.
message:
angle!
need a method
can
send
the
for
converting
message $
to
members
the
floating
of
the
point
class
float
numbers
and
receive
to
nearest
the
value
whole
rounded
dollar
to

EXAMPLE
addto
SMALLTALK
float
G7
(<I
$
CLASS
=>
(1t
DEFINITIONS
0.0 + (0 + (0.5 + SELF.)
The
class
float
can
now
take 8 floating
nearest
dollar.
..
100)
1100))!
point
number
and
round
Page
to
86
the
Now for
at
the
The
Definition
the
end
of
to
payment
(demand
demand
demand
demand
~
@=>
~
report'
report
definition
the
payments
rate
of
load
period.
of
the
principal
rate
principal
interest
period
payments
f-(O.O +
payment,
Class
Payment
interest
increase
as
'Amount
as
'Interest
as
'Number
as '
Number
interest) I 100
increase f-(1.0 + rate)
amount f-((principal
Each
'Total
Payment
Amount
is
Paid
a
method
period
total
Rate
of
ipow
* rate *
$ ,
amount.
is $'
for
of
the
as
a percentage'.
Years
to
of
Payments
..
payments.
(period
computing
Loan
in
Pay
Off
per
..
payments).
the
decimal
the
Loan
Year'.
total
d·--d.dd
increase) I (increase
.
G1='total f-amount * (period"
'.
-
1))
amount
I.
$.
payments).
of
dollars
Request
Compute
0.0
to
point
number.
Compute
Compute
paid
over
nearest
and
report
Compute
amount
paid
four
values
the
rate,
guarantee
the
increase.
the
total
the
period
dollar.
it.
and
tell
paid
over
on a loan
adding
floating
amount
to
total
the
period
the
Sample
Run
this
payment!
For
example,
Amount
Interest
Number
Number
Each
Payment
Total
Amount
Total
Interest
report
'Total
Interaction
by
typing
the
of
the
Loan
Rate
as
a percentage
of
Years
of
Payments
is $
Paid
Paid
Interest
interaction
in
decimal
to
Pay
Off
per
Year
241.0
is $
86760.0
is $
56760.0
Paid
between
d--d.dd
J.:l9!
the
Loan a 30!
D,,j
2!
$ ,
total -principal.)!
the
user
and
D
..
30000.00!
payment
might
look
like
Compute
tell
total
and
interest
paid.

EXAMPLE
SMALLTALK CLASS
DEFINITIONS
Page
87
Sequential
include
Stream.
Stringof
Small
Recall
n
the
(the
instance
(string
return
Files.
the
talk
system.
to
stringof
(@:»n ~ :.
1t
we
to
indisp
(Grdisp ~ :.
is a value
print
method
generic
of
form
as
the
Dictionaries
classes:
is' a
method
n
indisp
have
1t
already
g
eval)!
that
name
the
of
proper
stream
disp
we
for
class
n>.
vector,
string,
for
(n
defined
would
any
class
for a text
stream. We
Since
reply.
obset, stream,
converting a non-string
print.
1t
disp
indisp
like
display
disp
as
converted
is
to
convert
frame).
then
send n the
is a stream,
file.
contents))!
to a string.
its
printable
We
it
will
value
The
use
indisp
message
store
to a string.
simplest
form
into a string
to
set
print
which
the
string
It
is
way
to
do
that
up a context
should
form
as
its
included
this
is
it
can
in
which
basically
contents,
in
to
send
the
assume
to
disp
do:
disp
which
basic
that
disp
is
an
we
f-
The
following
utility
(1)
copies a single
with
copies a file
obtain
The
to
have
xfer
two
disk
xfer
dpl
this
filin
'xfer.'!
definition
object
routines
around.
file.
drives.
file
named
is
(xfer,
It
is
For
'valu.able' old to dpO
'valuable'
type
copym,
useful
example
from
xplot)
mainly
disk 1 onto a newly
are
for
transferring
file
'valu.able'
examples
of
files
new!
created
the
use
between
file of
of
the
disks
the
class
on
same
file.
an
name
Each
Interim
on
is a
useful
Dynabook
disk
O.
To

EXAMPLE SMALLTALK CLASS
to
xfer
f g h i
(dsoff·
c:;a
f ~ :.
('<lto
=>
((I:-
g ~ :.
DEFINITIONS
Turn
off
the
Fetch
the
The
message
display.
instance
(to)
of 8 file.
must
appear
for
the
format
to
be
Page
correct.
88
Gr
g ~ :.
disp ~ 'proper
, .
disp ~ 'xfer
, .
disp ~ 'where
f close. g close.
(2)
copym
copies
type
This
where
The
multiple
copym
copies
co
pym
<text>
definition
repeat
g
f's
nextp
shorten
(file>
(g ~ f's
= 0
to
format
to
<file>
(numch
=>
here)
is:
(file>!
may
(done)
be
dson.)1
files
from
one
directory
dpl
to
dpO
Gr('filel')
'filel'
from
disk 1 to
<source directory> to <
is
the
uses
extension
the
object
for
xfer.
=
512
f set to
preceded
',sr'
'file1.sr'
destination
the
files
=>
(sadr)
f's
pagen
The
Sets
Otherwise
by
dpO
or
Close
to a directory
I
on
disk 0 (the
directory> < vector
on
the
destination
sadr[l
+ 1
repeat-loop
the
pagen
dpl')
the
two
on
the
new
to
0).
say
file).
numch]).
is
copying
and
bytcc
format
files
and
same
or
The
of
file
directory.
for
is
incorrect
turn
on
complete
names>
each
page
g.
the
another
The
of
display
disk.
syntax
(text>
extension
the
on.
file.
I
For
for
is
example,
copym
optional.
is
to
copym
(~sourcedir
sourcedir
~
<#"to.
@==»destdir ~ :.
@==»filenames ~ :.
(null
(G?ext ~ :.)
for
i to
filenames
(xfer
sourcedir
(3)
xplot
xplot
writes a screen
printing
these
the
Type
on
facilities.)
low
resolution
fHin
an
XGP
'xplot.'!
destdir
:.
length
with
Either
(picture)
filenames
=>
(@='ext ~ "))
- 1
file
filenames[i]
image
the
low
(bitmap)
XPLOT
or
part
ext
program.
high
resolution
of a screen
i
old
to
destdir
onto a file
(lIenee
screen
with
file
(86-87
this
images
both
filenames[i] + ext
disk
is
low
pages,
particularly
can
and
be
high
takes
plotted,
resolution
useful
but
new))!
about
to
not
parts
one
those
both;
minute)
readers
will
i.e.,
be
for
with
only
saved.

EXAMPLE
The
following
simple
instance
rectangular
a
message--the
to
{<l's
to
to
form
of
method
AREA
<I
<I
isnew
PNT
xplot
abc I origin
=>
(11'
is
=>
(ISIT
makebuff
=>
(ctrorigin ~ :.
(mem
f h
( ((("ff>f ~ :)
for
SMALLTALK CLASS
definition
of
class rectangle
AREA
area.
The
restoring a display
file
name.
g
eval)
eval)
=>
((f?a ~ string
@:.
BLT
11'
a)
255 ~ :.
irs
w
is
file
~f
~
file
to
the
file
extent
c~
PNT
c + 2 b 0
Gr
11'
mem
=>
( )
f
=>(
requires
defined
message
'xplot'
2
a.
extent
extent
255)!
)
ltfalse).
'"
the
makebuff
also
screen
extent
x 0
~
:))!
DEFINITIONS
class
AREA
in
Chapter
includes
from a file
y
'"
extent
is a
the
Gr b
y 0
II
objects
~
Make
which
and
string
is
later
containing
BLT,
written
(extent
mem
60
sure f is a file.
also
provided
in
this
PNT,
by
the
x +
15)
I
32
origin x origin y extent
chapter.
the
and
bringitin.
object
16.
below.
sequence
xplot.
The
Note
response
of
This
It
y
Page
AREA
bits
in
last
expects
O.
is
of
one
89
a
an
the
is
one
GT'w
(0 < mem
f
next
dsoff·
@='
r ~ AREA
do 4
(f
for i to s
(f
r's
f close.
~
255
Elmem
It + 1
=>
word
~
4.
point
next
word ~ 0).
next
word ~ - w. f ~ r
(urorigin
dson.)!
(Grh ~ mem
(f
next
word
Cff's
~
2 *
Grs ~ mem
0 0
point
~
po~nt
0
272)+
~
2.
mem
h +
w·
16
1.
makebuff.
i)).
h +
3).
3)
1.
Number
High
Number
Low
The
each
Default
-word
Move
of
words
per
resolution --enlargement.
of
scan
lines.
resolution.
screen
area
is
time
in
the
next
values.
count
followed
the
area
down
scan
written
loop.
by
the
line.
out
bits
screen.
in
on
the
scan
file
line.

EXAMPLE
Dispframe
SMALLTALK
CLASS
DEFINITIONS
Page
90
disp.
instance
As
explained
of
the
cJ?disp f-dispframe
A
Small
talk
disp.
keyboard
dispframe
As
dcomp,
an
1.
2.
This
interactions
named
example
dmove,
Create
Place
original
class
window,
particular
disp.
both
and
dmovec),
four
them
dialog
window
window 3 I
in
Chapter
dispframe
16
as
demonstrated
name
will
be
of
using
try
new
windows
in
four
window.
1 I
I
I
III,
and
480
415
must
carried
this
the
quadrants
window
window
disp
is
created
168
in
be
used
out
generic
following
on
your
2 I
4 I
is
the
as
string
Chapter
because
by
name
sequence.
display
of
the
I
I
local
name
520!
I,
owns
the
displaying
as
well
as
screen.
screen,
of
any
an
instance
Small
talk
the
typed
of
using
enlarging
dialog
of
read
characters
the
four
them
window.
a
dispframe
method
display
to
fill
It
assumes
in
an
routines
the
is,
whose
instance
area
in
fact,
name
that
above
an
is
all
of
edelear,
the
Try
3.
Place
This
the
4.
Repeat
turt2,
5. Now
turt1
home
for
i to
turtl's
different
turt2's
turt3's
original
dialog
window
the
mouse
creates a turtle
window.
the
above
turt3,
point
in
erase!
200
(tartl
frame'S
(dcomp
designs in
frame'S
frame'S
(delear
(delear
cursor
process:
and
turt4.
the
original
go i turn
frmx
each
of
frmx
frmx
in
window 1 and
who
dialog
89)!
frmwd
the
four
frmwd
{rmwd
lives
only
enter
each
window
frmy
windows. Or
frmy
frmy
type
in
this
of
and
(rmht)!
fnnht
(rmILt
@=>turt1 (-turtle
first
window.
the
remaining
try:
Note
only
Note
the
Complement
try
13107)!
12121)!
home
three
window 1 is
turtle
draws
window
frame
for
turtl
windows
erased.
lines
only
1.
disp!
and
in
is
its
the
create
own
center
turtles
window.
of

EXAMPLE SMALLTALK CLASS
As
examples
to
do
or
do
mover
(turt4's
10
(mover
10
(mover
of
using
frame's
O)!
1)!
dmove,
(dmove
try
making
frmx
frmwd
DEFINITIONS
window 4
frmy
small
frmht
turt4's
replacing
turt·s
interacting
area.
and
then
~frmx~frmx-5
window
window
any
information
with
moves
moves
any
~frmy~frmy-5
toward
the
already
toward
the
information
bottom
displayed
bottom
already
leCt
in
left
corner,
displayed
:))!
corner,
the
Page
areas.
in
the
91

EXAMPLE SMALLTALK CLASS
DEFINITIONS
Page
92
Point
This
two
class
definition
~joe
joe
joe
joe
joe clear
joe
class
data
type
rectangles
rectangle was
of rectangle,
filin
'xyfns.'!
~
rectangle
has
point
point
campi
clear
-1
I
21212!
clear
052525!
is used
and
120
100
to
create
introduced
type
point
100
1051
100
design
the
100
joe intersect ~ jim f-rectangle
the
class rectangle which
rectangle
at
point
point
the
150
140
that
end
120
of
1501
encloses two
Chapter
Rectangle
corner
That
Complements
Clears
Some
point
II
250,
is,
joe to
nice
150
1701
jim
is a rectangle
290,290.
upper
left
140
120j
can
compute
rectangles.
section
at
upper
250
'not
Calse'
joe's
all
black.
patterns.
Reply
140,120
extent
is
on
leCt
and
thereCore
bits.
at
upper
is
intersection
and
point
areas
An
abbreviated
Paint
corner
left
lower
right
110
130).
of
intersection
Brush.
100,100
true
140,120
of
joe
and
250,
between
version
To
obtain
and
lower
and
lower
jim, a rectangle
250
(origin
of
is
the
this
right
right
at
point
joe
include
joe move to
joe
frame!
The
code for
loadbuff)
understood
jim!
2003001
the
class rectangle
used
in
the
by a rectangle.
definition
and
of
some
AREA
useful
as
Creates
Upper
Draw a
routines
stored
rectangle
leCt
black
follow.
on
file
corner
border
around
is moved
around
Note
'xplot'
joe
and
jim.
to
200,
300.
the
rectangular
two messages
could
be
area.
(makebu,ff
included
and
as messages

EXAMPLE
SMALLTALK
CLASS
DEFINITIONS
Page
93
to rectangle
(
<[has=>
abc I origin
(c;rc ~ :. 1torigin c
<['s:>(1t g
eval)
<[comp=>
(dcomp
origin x extent x origin y extent
<[clear=>
(dclear
origin x extent x origin y extent
<[intersect=>
(Grc ~ :.
Gra ~ origin
Grb ~ (origin + extent)
a ~ b=>
(1trectangle a b -
<[include=>
(~c
~:.
@=oa ~ origin
CJ.rb ~ (origin + extent)
1trectangle a b <[moveto
<[frame
=>
(urorigin ~ :)
=>
(@""a ~ turtle.
up
penup
2
(a
ISIT
=>
=>
=>
(Grorigin
goto
goto
go
eval)
(CODE
a pen
a
do
<[is
=>(
<[print
(~rectangle
<[
paint
isnew
extent
origin + extent)
max
c'S
origin.
min
c'S
origin.
a)
origin
origin
turn
turn
extent x turn
print
sp
origin
41)
~:.
~extent
min
a)
max
90
90
90
c's(
origin + extent).
1tfalse)
c's(
origin + extent).
pendn's
pendn's
go
print
width
width
extent y turn
sp
extent
~
:))!
y)
y
:)
~
~
print)
Is a
Expects
Creates a rectangle
and
else,
Creates
Move
Turtles
well
2.
2.
90))
This
section
point
inside
bit
patterns
SELF
if
they
'false'.
rectangle
origin
to a new
understand
as two
numeric
message was
on
Paint
rectangle?
as a message
that
have
common
around
point.
how
coordinates.
discussed
Brush.
is
the
intersection
arca
SELF
and
to go to a
in
Chapter
c.
point
II
as
of
c
to
waitnext
(urx
~
repeat
repeat
to
bug
(waitnext
A
demonstration
to
xydemo ~ class
(ura
a
G?c ~ rectangle
c
Grb
(b=>(b
(a
Type
xydemo!
The
result
black,
white,
x
8.
{x
eval
(x
eval
camp.
camp.
~
include
of
pointing
and
=>
=>
but
to
f-
rectangle
a
intersect
clear
gray
( )
done)
(done)))!
1 on.
1tmp)!
try
often
abc
Grb ~ bug
Grb +-bug
13107))
c)
frame.)!
to
different
rectangles.
Stay
in
this
x is
first
'not-false'
Wait
to
when
button
'false'
again.
get
routine
the
until
and
then
mouse
point
1 is preEsed.
finally
is
bug -b.
bug
- b.
c.
screen
locations
is a
geometric
design
formed
by
the
interaction
of