Dylan is built around two central concepts: objects and functions.
Objects are the data that exist in Dylan programs. Objects are mapped into a class heterarchy. FN3 The class heterarchy describes the inheritance relationships among classes. The class <object> is the root of the heterarchy. Every class inherits from its direct superclasses (except for <object> which has no superclasses). Classes may also have subclasses, which inherit from them, either directly or indirectly. The superclasses[next citation] of a class are the class itself, its direct superclasses, their direct superclasses, and so on back to the class <object>.
Every object in the Dylan world is a direct instance of exactly one class. This class is referred to as the class of the instance. For each object O that is a direct instance of class C, the object O is also an indirect instance of all the superclasses of C (except C itself). (It follows that every object in Dylan is an indirect instance of <object>.) The term general instance means either a direct or indirect instance.
Dylan defines three categories of classes:
A method[next citation] is a basic callable unit of code. It contains a typed argument list and a code body. The types in the argument list are called the specializers of the method. A method can only be called with arguments that match the specializers of the argument list. (In the most common case, the specializer is a class, and the corresponding argument must be a general instance of the class.) When the specializers of a method match a set of arguments, the method is said to be applicable to the arguments. If a method is called with inappropriate arguments, an error is signaled.
A generic function contains zero or more methods. When a generic function is called, the arguments are compared to the specializers of all the methods in the generic function. The method with the most appropriate specializers is run. reference p. 53 In this way, a generic function chooses a method based on the classes and identities of its arguments. This is the basic technique for object-oriented dispatch in Dylan.
In contrast to methods in other object-oriented languages, Dylan methods can be called directly. They do not need to be added to generic functions. Used this way, methods play the role of blocks in Smalltalk and closures in Lisp.
Classes and functions are themselves first-class objects, which can be manipulated by programs.
Structure of Dylan
The Dylan language consists of a core language plus several libraries of useful functionality. The core language is designed to be conceptually minimal, but not to be a useful or complete language. Any useful program will probably use several of the libraries.
The Dylan core language consists of the literal constants and the following named entities:
The libraries specified as part of the Dylan language are as follows:
A number of additional libraries are not defined by the language, but are provided by each implementation in a way consistent with the environment in which that implementation runs. This includes such facilities as the File System, User Interface, etc.