I am interested in adding Traits to the Java language. Briefly Traits
are like interfaces but you can have method bodies, but no
constructors or fields. If there is a conflict you have to resolve the
conflict:

interface X { int m() { return 1; } }
interface Y { int m() { return 2; } }
class XY implements X, Y { // conflict - 2 m methods
  public int m() { return X.m(); } // resolve conflict - otherwise
error
}

More info. at: http://www.artima.com/weblogs/viewpost.jsp?thread=220916

This is easy (well if you call modifying the compiler easy) if you
force recompilation. However it would be an advantage to allow Traits
to be extended without recompilation since at present an interface is
in effect a fixed entity, e.g. change X:

interface X {
  int m() { return 1; }
  String s() { return "A"; }
}

Ideally you wouldn't want to have to recompile XY, instead it would be
nice if the class loader automatically added method s to XY (assuming
that XY didn't have an s already).

Does anyone have any wisdom they are willing to impart on the
practicality of writing a custom class loader or modifying *the* class
loader to achieve this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to