brownplt / lambda-py

Other
58 stars 10 forks source link

Bug: a.f() is desugared incorrectly #26

Closed anandology closed 11 years ago

anandology commented 11 years ago

This is related to issue #13. (see testcase).

a.f() is desugared as:

(CApp
    (CGetField (CId 'a (GlobalId)) 'f)
    (list (CId 'a (GlobalId)))
(none)))

This is implemented to support object methods. But it is not the appropriate place. This can be wrong in some cases. For example:

a.f = lambda x: x
a.f(4)

Ideally, it should be desugared to:

(CApp
    (CGetField (CId 'a (GlobalId)) 'f)
    (list)
    (none))

And object methods support should be handled by CGetField implementation.

amtriathlon commented 11 years ago

Hi Anand, this is essentially the problem with #13, I have planned to work on this after I finish with super(), but if you are ready to start now, go ahead!

amtriathlon commented 11 years ago

I will start looking at this problem since it its blocking me with super(), basically the super() object cannot be implemented without a correct implementation of method calls.

amtriathlon commented 11 years ago

Fixed in multiple_inheritance branch https://github.com/brownplt/lambda-py/commit/fa69d52067f32797720a22da37da4b25d8616be2