Skip to main content

Proxy-like keyword or annotation (instead of multiple inheritance)

No replies
mgrev
Offline
Joined: 2003-08-12
Points: 0

Multiple inheritance is out if the question, for a good reason.

In C++ MI was/is often used, questionably, to inherit functionality from utility classes. For instance inherit from EventListenerList to get listener handling 'for free' in a class.

This is not such a bad idea, but that 'proxying' should not change the type if the class, IMO. Today we just aggreagate it and proxy all methods and we are on our way. But, if the proxy changes all places where it's used will have to change as well.

I suggest some method to automatically proxy objects. Be it using annotations, a new keyword or whatever, that is up to the language experts. But I do think auto-proxying could not only save A LOT of keystrokes, but also simplify reuseability and actually increase simplicity.

Cheers,
Mikael Grev