Basic Classes




object [class]


  :super    

:slots


Object is the most basic class that is located at the top of class hierarchy. Since it defines no slot variables, it is no use to make an instance of object.


:prin1 &optional stream &rest mesg [method]

prints the object in the standard re-readable object format, that is, the class name and the address, enclosed by angle brackets and preceded by a pound sign. Any subclasses of object can use this method to print itself with more comprehensive information by using send-super macro specifying mesg string. An object is re-readable if it begins with #$<$, followed by its class name, correct address, any lisp-readable information, and >. Since every data object except numbers inherits object, you can get print forms in this notation, even for symbols or strings. Specifying this notation, you can catch data objects that you forgot to setq to a symbol, as long as there happened no garbage collection after it is printed.


:slots [method]

returns the list of variable-name and value pair of all the slots of the object. You can get the value of a specific slot by applying assoc to this list, although you cannot alter them.



propertied-object [class]


  :super   object 

:slots plist


defines objects that have property list. Unlike other Common Lisp, EusLisp allows any objects that inherit propertied-object to have property lists, even if they are not symbols.


:plist &optional plist [method]

if plist is specified, it is set to the plist slot of this object. Previous plist, if there had been one, is lost. Legal plist should be of the form of ((indicator1 . value1) (indicator2 . value2) ...). Each indicator can be any lisp form that are tested its equality with the eq function. When a symbol is used for an indicator, use of keyword is recommended to ensure the equality check will be performed interpacakge-widely. :plist returns the current plist.


:get indicator [method]

returns the value associated with indicator in the property list. (send x :get :y) == (cdr (assoc :y (send x :plist))).


:put indicator value [method]

associates value to indicator in the plist.


:remprop indicator [method]

removes indicator and value pair from the plist. Further attempt to :get the value returns nil.


:name &optional name [method]

defines and retrieves the :name property in the plist. This property is used for printing.


:prin1 &optional stream &rest mesg [method]

prints the object in the re-readable form. If the object has :name property, it is printed after the address of the object.


:slots [method]

returns a list of variable and value pairs of this object.


:methods [method]

returns a list of all method names defined for this object. In other words, this object can accept method calls listed by :methods.


:get-val variable-name [method]

returns the value of the slot designated by variable-name. If the object does not have the variable-name slot, an error is reported.


:set-val variable-name value [method]

sets value in the variable-name slot of this object. If the object does not have the variable-name slot, an error is reported.



metaclass [class]


  :super   propertied-object 

:slots name super cix vars types forwards methods


Metaclass defines classes. Classes that have own class variables should be defined with metaclass as their superclass.


:new [method]
creates an instance of this class and returns it after filling all the slots with NIL.


:super [method]
returns the super class object of this class. You cannot alter superclass once defclassed.


:methods [method]
returns a list of all the methods defined in this class. The list is composed of lists each of which describes the name of the method, parameters, and body.


:method name [method]
returns the method definition associated with name. If not found, NIL is returned.


:method-names subname [method]
returns a list of all the method names each of which contains subname in its method name. Methods are searched only in this class.


:all-methods [method]
returns a list of all methods that are defined in this class and its all the super classes. In other words, an instance of this class can execute each of these methods.


:all-method-names subname [method]
returns a list of all the method names each of which matches with subname. The search is made from this class up to object.


:slots [method]
returns the slot-name vector.


:name [method]
returns the name symbol of this class.


:cid [method]
returns an integer that is assigned to every instance of this class to identify its class. This is an index to the system-internal class table, and is changed when a new subclass is defined under this class.


:subclasses [method]
returns a list of the direct subclass of this class.


:hierarchy [method]
returns a list of all the subclasses defined under this class. You can also call the class-hierarchy function to get a comprehensive listing of all the class hierarchy.


find-method object selector [function]
searches for the method identified by selector in object's class and its super classes. This function is useful when object's class is uncertain and you want to know whether the object can handle the message without causing nomethod error.


k-okada 2013-05-21