10.13.6.12 define_method/3

Synopsis

define_method(+Obj, +Message, +Body)

Arguments

Obj
object
Message
term
Body
callable

Description

Install Body as the method for Message in the instance Obj. Following the execution of this goal, sending Message to Obj will execute Body, rather than the default method or a method previously defined with define_method/3.

Message must have been declared to be an instance method for the class of Obj.

Exceptions

instantiation_error
any argument is unbound.
type_error
Obj is not a compound term, or Message or Body is not callable.
domain_error
Message does not specify an instance method for the class of Obj, or Body include a goal to fetch or store a non-existent slot.

See Also

instance_method/1, undefine_method/3


Send feedback on this subject.