Product Documentation
Cadence SKILL++ Object System Reference
Product Version IC23.1, June 2023

defmethod

defmethod( 
s_name 
( 
( s_arg1 
  s_class 
) 
s_arg2 ... 
)
g_exp1 ...
) 
=> t

Description

Defines a method for a given generic function. This is a macro form. Be sure to leave a space after s_name.

The method is specialized on the s_class. The method is applicable when classp( s_arg1 s_class ) is true.

Arguments

s_name

Name of the generic function for which this method is to be added. Be sure to leave a space after s_name.

( s_arg1 s_class)

List composed of the first argument and a symbol denoting the class. The method is applicable when s_arg1 is bound to an instance of s_class or one of its subclasses.

g_exp1 ...

Expressions that compose the method body.

Value Returned

t

Always returns t.

Examples

defmethod( whatis (( p Point ))
sprintf( nil "%s %s @ %n:%n"
className( classOf( p ))
p->name
p->x
p->y
)
) ; defmethod
=> t

Related Topics

Generic Functions and Methods

defgeneric

procedure

defun


Return to top
 ⠀
X