next up previous contents index
Next: 1.8.2 Modules Up: 1.8 Code organization Previous: 1.8 Code organization   Contents   Index

1.8.1 Procedures

Named procedures can be created by associating a name in one of the dictionaries on dstack with a procedure. There is nothing magical about this, but some care should be taken in choosing procedure names, and in deciding how to manage the namespace. Onyx uses only lower case letters in the names of its definitions on dstack, so it is easy to avoid namespace collisions by using some other character in program definitions. There is nothing wrong with using all lowercase letters for names in your programs, though some extra care is warranted when doing so.

An important consideration in program design is determining what belongs in the global namespace. For an example of how Onyx partitions its namespace, look at gcdict. There are several operators defined in gcdict that are only of interest when manipulating the garbage collector, so those definitions are stashed out of the way. Your program can do the same for definitions that are not of regular interest.



Jason Evans 2003-01-31