next prev up top content index

9 Sealing

Declaring Characteristics of Generic Functions

A generic function definition may include either the adjective sealed or the adjective open. These adjectives declare whether the generic function is sealed.

If a generic function is sealed then no additional methods other than those explicitly known in the same library may be added to the generic function and no methods may be removed from it. Thus, it is an error to define a method for a sealed generic function in some library other than the one which defined the sealed generic function, or to apply add-method or remove-method to a sealed generic function. An open generic function does not prohibit these operations.

When explicitly defining a generic function, the default is for the generic function to be sealed. It can be declared to be open by using the open adjective in the generic function definition. A generic function that has no explicit definition but has an implicit definition provided by explicit definitions of generic function methods or slot accessors is also sealed. A generic function created using make of <generic-function> is open. There is no specified way to create a sealed generic function using make.

Additional restrictions on the ability to add methods to a generic function may be imposed by define sealed domain.