Recursive Polymorphic Methods
A method
is an abstract function object that incorporates
a set of specialized functions that can then be applied
uniformly to all of the function domains.
SIGNATURE Method[general, result] /$ DYNAMIC [general] $/ SORT general result
A method
encapsulates a function that realizes the topmost
branch of specialization. The function fun
applied to the
body of the whole method, to be invoked on recursion, will yield
a function from general
to result
.
TYPE method == method(fun : method -> general -> result)
To give implementing specializations of a method access to the
whole method body including specializations that were included
on top, each specialization must take an argument
containing the whole invocation-time method body. The function
recursion
sets up the recursion environment. The
expression recursion(m)
is equivalent to fun(m)(m)
.
FUN recursion : method -> general -> result
next node: MethodEnv,
prev node: Dynamic,
up to node: User Subsystem : Reflections