Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

Sending Messages

The mechanism for sending messages to XLISP objects is via the SEND function. It takes an object, a message selector and various optional arguments (depending on the message selector).

The way that a user creates a new object is to send a :NEW message to a previously defined class. The result of this SEND will return an object, so this is normally preceded by a SETQ. The values shown in the examples that follow may not match what you see if you try this on your version of XLISP - this is not an error. The screens that are used in the various examples are similar to what you should see on your computer screen. The ">" is the normal XLISP prompt (the characters that follow the prompt is what you should type in to try these examples).

 ________________________________________________________________
|
|       > (setq my-object (send object :new))
|       #<Object: #2e100>
|________________________________________________________________

The object created here is of limited value. Most often, you create a class object and then you create instances of that class. So in the following example, a class called MY-CLASS is created that inherits its definition from the a built-in CLASS definition. Then two instances are created of the new class.

 ________________________________________________________________
|
|       > (setq my-class (send class :new '()))
|       #<Object: #27756>
|       
|       > (setq my-instance (send my-class :new))
|       #<Object: #27652>
|
|       > (setq another-instance (send my-class :new))
|#<Object: #275da>
|________________________________________________________________

Go to the first, previous, next, last section, table of contents.