Next: , Previous: Class Datatype, Up: Classes


1.2 Predefined Classes

sos provides a rich set of predefined classes that can be used to specialize methods to any of Scheme's built-in datatypes.

— Class: <object>

This is the class of all Scheme objects. It has no direct superclasses, and all other classes are subclasses of this class.

— Class: <instance>

This is the class of instances. It is a direct subclass of <object>. The members of this class are the objects that satisfy the predicate instance?.

— Class: <boolean>
— Class: <char>
— Class: <entity>
— Class: <pair>
— Class: <procedure>
— Class: <record>
— Class: <string>
— Class: <symbol>
— Class: <vector>

These are the classes of their respective Scheme objects. They are all direct subclasses of <object>. The members of each class are the objects that satisfy the corresponding predicate; for example, the members of <procedure> are the objects that satisfy procedure?.

— Class: <generic-procedure>

This is the class of generic procedure instances. It is a direct subclass of <procedure>.

— Class: <method>

This is the class of method objects. It is a direct subclass of <instance>.

— Class: <chained-method>
— Class: <computed-method>
— Class: <computed-emp>

These classes specify additional method objects with special properties. Each class is a subclass of <method>.

The following are the classes of Scheme numbers. Note that object-class will never return one of these classes; instead it returns an implementation-specific class that is associated with a particular numeric representation. The implementation-specific class is a subclass of one or more of these implementation-independent classes, so you should use these classes for specialization.

— Class: <number>
— Class: <complex>
— Class: <real>
— Class: <rational>
— Class: <integer>

These are the classes of the Scheme numeric tower. <number> is a direct subclass of <math-object>, <complex> is a direct subclass of <number>, <real> is a direct subclass of <complex>, etc.

— Class: <exact>
— Class: <exact-complex>
— Class: <exact-real>
— Class: <exact-rational>
— Class: <exact-integer>

These are the classes of exact numbers. <exact> is a direct subclass of <number>, <exact-complex> is a direct subclass of <exact> and <complex>, and in general, each is a direct subclass of preceding class and of the class without the exact- prefix.

— Class: <inexact>
— Class: <inexact-complex>
— Class: <inexact-real>
— Class: <inexact-rational>
— Class: <inexact-integer>

These are the classes of inexact numbers. <inexact> is a direct subclass of <number>, <inexact-complex> is a direct subclass of <inexact> and <complex>, and in general, each is a direct subclass of preceding class and of the class without the inexact- prefix.