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

ansiDefmethod

ansiDefmethod( 
s_name 
l_spec 
g_body 
) 
=> t

Description

A SKILL++ defmethod macro for supporting lexical scoping in callNextMethod. It creates a closure for a method.

Arguments

s_name

A method name.

l_spec

A list of specializers for the specified method.

g_body

Body of the method.

Value Returned

t

Always returns t.

Examples

(defclass Parent () ())
(defclass Child (Parent) ())
(defmethod Printer ((self Parent) function)
(error "This line is never reached"))
(defmethod Printer ((self Child) function)
(printf "The function returns %L\n" (funcall function)))
(defmethod Caller ((self Parent))
'Parent)
(ansiDefmethod Caller ((self Child))
(Printer self callNextMethod))
(Caller (makeInstance 'Child))
The function returns Parent
=> t

Related Topics

Generic Functions and Methods


Return to top
 ⠀
X