Defines a method.
Methods can be invoked using met-name
or call-met
.
Just like fields, methods are bound to both a qualified name and an
unqualified name.
Methods don't participate in name shadowing. Instead, consider using a wrapper method.
Methods don't receive an explicit "self object" parameter. Within the body of a method,
the @
syntax can be used to access the self-object.
Any of a method's parameters can be prefixed with @
. This causes the form
(= @param-name param-name)
to be automatically emitted at the beginning of the
method's body.
(defclass Example
(field x)
(prop y (get) (set))
(met receive-values (@x @y)
(prn @x @y)))
; ...is equivalent to...
(defclass Example
(field x)
(prop y (get) (set))
(met receive-values (x y)
(= @x x)
(= @y y)
(prn @x @y)))