Thank you for explanation. :)
 
25.10.2017, 18:12, "Alain Frisch" <alain@frisch.fr>:

On 25/10/2017 16:35, vadim@radovel.ru wrote:

 Ivan, thank you for answer.
 Do you mean, that in the following example method is
 resolved(dispatched?) at compile time?


Calling M.method_a will still be an indirect function call (to a
function unknown at compile-time). But accessing the closure (and the
code pointer in it) will be done by simple lookups: each first class
module will be represented as a block holding one value (the closure).

With objects, each method invocation needs to do some dynamic lookup to
find the method in a table (indexed by an integer representing the
method name). A cache mechanism exists and makes the lookup often
reasonably fast, but of course still slower than just following a
pointer at a known location.


-- Alain