Example String defMethod 002
|
This example calls the defMethod function where the method makePlural
is implemented for the datatype Text. The method makePlural is invoked by the
send function calling the message in the Text Methods Dictionary.
Notes and Hints It is important to remember that String constants that are 7 characters or
less are by default assigned a type of Text unless explicitly assigned to a
String Symbol variable. All functions that are applicable to Strings
(append, mid, right, etc.) are applicable Text constants as well.
The fact that a constant is a Text or String is normally transparent to the user. The Methods Dictionary exists for both the String type and the Text type.
The constant "Hello" would, by default, be assigned as a Text constant if
the following Lisp statement were used: (setq SText "Hello") The method makePlural: which was installed as a method for the
String type by the defmethod function would not be able to the understand
the following Lisp instruction: (makePlural SText:) Since the argument to the makePlural message, Stext, is a
Text String, the Lisp compiler will go the Methods Dictionary for the Text data
type. However there is no makePlural method for the data type Text.
Recall that the makePlural method was installed in the String data type
Returns:
Returns:
Returns:
Here are examples of the defMethod function at work.
Brick defmethod 025 | Dictionary defMethod 006 | Directory defMethod 007 | Matrix defMethod 009 |
String defMethod 001 | String defMethod 002 | Symbol defMethod 003 |
Here is the link to the current function used in this example.
Here are a number of links to other related functions.
addMethod(#void) | send(#void) | methodsOf(#void) |
Here are the links to the data types of the arguments used in this example. Here are a number of links to examples having similar argument types.
String
Text
Dictionary
Analytic Information Server (AIS)AIS Component Systems
|