Binds a method to the object or class that called it, or to the object or class passed in the second parameter. In Parser all methods
are bound to the execution context (self) and this way you can change this binding.
Example @main[]
$a[^A::create[]]
# ^a.m[] - m method can't be used directly as field m has a priority over it # thus using ^reflection:method[] to get m method
$method[^reflection:method[$a;m]]
^method[]
$b[^B::create[]]
# We substitute self to call the method m in the context of another object, we store result in object b
$b.m[^reflection:method[$method;$b]]
#now object b has method m ^b.m[]
@CLASS
A
@create[]
$name[object of class A]
$m[object field]
@m[]
method of class A, called on $name
@CLASS
B
@create[]
$name[object of class B]
Returns:
method of class A, called on object of class A
method of class A, called on object of class B