request("STRING")
message to the object. Strings and other objects that have string values return
the appropriate string value for Rexx to use. (This happens automatically
for strings and for subclasses of the String class because they inherit a
suitable makeString method from the String class.)
For this mechanism to work correctly, you must provide a makeString
method for any other objects with string values.makeString
method), the action taken depends on the setting of the NOSTRING condition
trap. If the NOSTRING condition is being trapped (see
Chapter 11, Conditions and Condition Traps),
the language processor raises the NOSTRING condition. If the NOSTRING condition
is not being trapped, the language processor sends a
string message to the
object to obtain its readable string representation and uses this string.
d = .directory~new
say substr(d,5,7) /* Produces "rectory" from "a Directory" */
signal on nostring
say substr(d,5,7) /* Raises the NOSTRING condition */
say substr(d~string,3,6) /* Displays "Direct" */
String arithmetic, comparison, and concatenation methods:request("STRING") message is sent to the argument object.
If request returns .nil because the argument object
does not have a makeString method, and the NOSTRING
condition is not being trapped, a
string message is sent to
the object to obtain its string representation.
request("STRING") message.
If request returns .nil, the method raises an error.