method. Getting object's method   [3.4.2]

^reflection:method[object;method name]
^reflection:method[class;method name]

Returns method of object or class. The method could be used in user-defined classes where the field has priority over the method with the same name.

^reflection:method[метод]   [3.4.5]
^reflection:method[метод;объект]   [3.4.5]

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.



^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



We substitute self to call the method m in the context of another object, we store result in object b

# now object b has method m


$name[object of class A]
$m[object field]

method of class A, called on $name


$name[object of class B]


method of class A, called on object of class A
method of class A, called on object of class B

Copyright © 1997–2021 Art. Lebedev Studio | Last updated: 25.04.2017