3.25: adda/type literals:
. a full adt description needs both a
set of operations
and a set of value literals .
. definitions of type enum are listing
just the values
because the set of operations are from
the scalar.class,
which by definition include certain operations:
relationals (equality, inequality),
assignment, and functions for expressing values as
an integer or string:
ord is the value's place in scalar order;
val is the numeric encoding of the state;
image is the graphic view of state
-- typically a character string
but can also be an icon:
. every graphic icon has a title (a filename),
and many images have nothing but a title;
eg, to describe the state of color,
you'd use the name of the color without necessarily
mapping it also to a colored block image .
[3.31:
. perhaps the most natural way to show in an interface
that a set of symbols are the type's value literals,
is to express them as the return values of the function:
image()
-- understood to return the type's value literals:
`image.{ v1, v2, ...} .
`val.{ n1, n2, ... } could then show
by correspondence with image,
the mapping of images to codes (assuming val was
contracted to be part of the interface) .]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment