Re: Understanding Classes



alexandre_paterson@xxxxxxxx wrote:

IDEA doesn't just write the methods skeletons, it also generates
all the delegated method calls to the wrapped subject.

That's nice. They'll have to get that feature into NetBeans soon. :)

Actually if I'd known about Project Coin, I might have suggested something for the Java compiler like that. For example:

Mix-ins for Java

Allow the interface of a class to specify an instance variable which implements that interface:

class Karel extends Robot implements Jumping(jump), Colors(color)
{

Jumping jump;
Colors color;

... etc. rest of class ...
}

Here, the Jump interface would be implemented by the jump instance variable. All methods in the Karel class would be implemented by the compiler to just call the same method on the variable jump. And the same for the Colors interface and the color variable.

I'm undecided whether the instance variables which implement an interface should be required to be final (my preference is not) or should be allowed to be an interface type or an abstract type, instead of required to be a concrete type (my feeling is that abstract or interface types are ok).

My 2 nickels.
.



Relevant Pages

  • Re: Understanding Classes
    ... Allow the interface of a class to specify an instance ... class Karel extends Robot implements Jumping, ... the Jump interface would be implemented by the jump ... interface type or an abstract type, ...
    (comp.lang.java.programmer)
  • Re: Density functional theory in hydrodynamics
    ... > handle the jump conditions across a material interface? ... > How do you handle Marangoni flow? ... How do you handle the jump conditions across a material ... In density functional theory there are no jumps across interface ...
    (sci.physics)
  • Re: Philosophy of Polymorphism (was: Meyer(s) gets it wrong)
    ... I am NOT talking to a driver - I am talking to an interface in the ... Thus, it is not a case of "instance variables", unless you consider the ... you have a single object (the dispatch printer) ... browser (and its programmer) have to make do with whatever server I ...
    (comp.programming)
  • Re: Density functional theory in hydrodynamics
    ... How do you handle the jump conditions across a material ... > In density functional theory there are no jumps across interface ... The capillary pressure jump is the result of the complex ... I mean that I can assign surface-excess properties such as ...
    (sci.physics)
  • Re: Instance variable in an interface
    ... >> classes which implements that interface. ... >> public class ClassAimplements EmpInterface { ... >> public void processEmp() throws ProcessFailureException { ... > ClassB cannot share instance variables. ...
    (comp.lang.java.programmer)

Loading