[Next] [Previous] [Up] [Top] [Contents] [Index]
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 "-definer" suffix used by definition macros, and the "-setter" suffix, described below.)
- Module bindings used to hold types begin and end with angle brackets.
<window>
<object>
<character>
<number>
<stream>
<list>
- Variable module bindings begin and end with asterisks.
*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 which return a true or false value.
subclass?
even?
instance?
- Operations that return a value similar to one of their arguments and which 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 and pop) 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 "-setter" to the corresponding getter binding name. This convention is used to generate setter names automatically, and it is used by
:=, the assignment operator, to find the setter that corresponds to a given getter.
element element-setter
size size-setter
color color-setter
Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]
Generated with Harlequin WebMaker