Chapter 2
Syntax
Naming Conventions
Several conventions for naming module bindings help programmers identify the purposes of
bindings. In general, the names of bindings do not affect the semantics
of a program, but are simply used to improve readability. (The
exceptions to this rule are the
suffix used by definition macros, and
the -definer
suffix, described later in this section.)-setter
- Module bindings used to hold types begin and end with angle brackets.
<window> <object> <character> <number> <stream> <list>
*parse-level* *incremental-search-string* *machine-state* *window-count*
- Program constants begin with a dollar sign.
$pi $end-of-file
- The names of most predicate functions end with a question mark. Predicates are functions that return a true or false value.
subclass? even? instance?
- Operations that return a value similar to one of their arguments
and that also destructively modify the argument end in
a
!
. (It will often also be the case that destructive and non-destructive variations of the function exist.)!
isn't a universal warning that an operation is destructive. Destructive functions that return other values (like-setter
functions andpop
) don't need to use the!
convention.
reverse! sort!
- Operations that retrieve a value from a location are
called getters. Operations that store into a
location are called setters. In general, getters and setters come
in pairs. Setter binding names are derived by appending
to the corresponding getter binding name. This convention is used to generate setter names automatically, and it is used by-setter
:=
, the assignment operator, to find the setter that corresponds to a given getter.
element element-setter size size-setter color color-setter