Integrated Application Platform › Forums › General › Poor man’s OOP : Mixins › Re: Re: Poor man’s OOP : Mixins
It is doable. Suneido assumes that classes and inheritance are “static”. i.e. you can’t add or remove methods or change super/base class “on the fly”.
Method lookup always starts in the super/base class – it does not look at the instance.
To fit in with this, mixin’s (or multiple inheritance) would also need to be static.
The current syntax is either: class : A { … }
or simply: A { … }
I could see extending this to: class : A,B,C { … }
or: A,B,C { … }
I don’t think this would cause any problems with parsing.
The main thing that would have to change is the method lookup. We’d have to decide exactly how it would work. Depth first would probably be easiest i.e. check A and all it’s super classes before checking B and it’s super classes.
If you had much multiple inheritance, it could make method lookup slow and you might need to cache method lookups.
PS. I always have to log in and out about three times to get around the redirect loop issue on this forum 🙁 Why don’t they fix that?