An idea on enabling typehole model in OT/J [message #568737] |
Sun, 21 February 2010 05:23  |
Eclipse User |
|
|
|
The idea is to make explicit and available to the users what OT/J uses implicitly.
A closest match to this idea is what Qi4j creators do declare an interface for a class and hope that someone else will provide an implementation for the methods declared in the interface.
In Qi4j they do it without extending the language just by listing the interface in the implements section and declaring the class abstract. This has a drawback that the class may miss methods from some other interfaces which it is intended to implement.
Implementing and declaring an interface are different intents and, thus, a dedicated language feature is preferable, for example keyword declares
interface ILowerable<T t> {
T lower();
}
protected class MyRole declares ILowerable<MyBase> playedBy MyBase {
void bar() {
MyBase theBase = lower();
}
}
The typehole can be filled by the compiler, by a class loader (from a library) or by the user via providing a role that implements the declared interface. The latter would probably require deliberating role classes from the teams, but this is a different topic :)
To avoid possible name clashes, the interfaces used in declares may be required not to overlap.
Regards
Eugene
|
|
|
|
Re: An idea on enabling typehole model in OT/J [message #568850 is a reply to message #568823] |
Mon, 22 February 2010 04:08  |
Eclipse User |
|
|
|
Hi Stephan,
Stephan Herrmann wrote on Sun, 21 February 2010 16:31
> ...
>
> For feeling motivated for the proposed change I would need to
> either see something really bad happening that can be avoided
> by the change or something really cool being possible if and
> only if we accept the change.
I'll try to find examples of really cool things possible with this feature :)
Cheers
Eugene
|
|
|
Powered by
FUDForum. Page generated in 0.05084 seconds