If memory serves me right, Jonathan Sillito wrote:
> x = a.f  # get the method, a limited form of currying
>          # since the first arg (a==self) is stored
> x()      # output: A.f()
> 
> setattr(A, "f", g)  # replace A's f with g
> 
> a.f()    # output: g()
> x()      # output (still): A.f()  !!!!!!!
> 
> Which shows that the dispatch (i.e. selecting which method to call) can
> happen before the invocation.

This makes sense .... let me put it in this way

x_mthdptr=a.__dict__["f"]
a.__dict__["f"]=g_mthdptr
x_mthdptr()

The dispatch vs invocation looks childishly simple when written this way..
(and I hope I'm right about that ... :)

Underneath the high level language most things are really simple ... The 
Python compiler should work around all these language quirks and generate
appropriate Parrot code ... In bytecode it should look direct, simple and 
fast !.

Gopal
-- 
The difference between insanity and genius is measured by success

Reply via email to