Chapter 11

The Built-In Classes

Simple Objects

Simple objects are sealed, uninstantiable, and concrete. They are often represented by program literals. Figure 11-2 shows the built-in classes of simple objects.

Figure 11-2 The Simple Object Classes

class boolean class symbol class character class object Simple Object Class Hierarchy
S – Sealed P – Primary C – Concrete I – Instantiable
O – Open F – Free A – Abstract U – Uninstantiable

Characters

<character> [Sealed Class]


The class of characters.

Superclasses:

<object>

Init-keywords:

None.

Description:

The class of characters. All characters are instances of <character>.

Operations:

The class <character> provides the following operations:

Table 11-8 Methods on <character>

Function

Description

Page

<

Returns true if its first operand is less than its second operand.

271

as-uppercase

Coerces an object to uppercase.

290

as-lowercase

Coerces an object to lowercase.

291

as

Coerces an object to a type.

288

Symbols

<symbol> [Sealed Class]


The class of symbols.

Superclasses:

<object>

Init-keywords:

None.

Description:

The <symbol> class provides a built-in, non-case-sensitive dictionary that associates a string with a unique immutable object that can be compared with == (which should be faster than calling a string-comparison routine). This dictionary is accessed through the as function: as(<symbol>, string) and as(<string>, symbol). Any string can be used.

Operations:

The class <symbol> provides the following operation:

Table 11-9 Methods on <symbol>

Function

Description

Page

as

Coerces an object to a type.

288

Booleans

<boolean> [Sealed Class]


The class of boolean values.

Superclasses:

<object>

Init-keywords:

None.

Operations:

None.

Description:

The class of boolean values. The literal constants #t and #f are general instances of <boolean>. Note that for the purposes of conditional expressions, all objects besides #f count as true. (This does not imply any other objects are instances of <boolean>.)