Interfaces without implementation are like a day without sunshine

Jeff Dyer jodyer at adobe.com
Thu Aug 24 11:19:55 PDT 2006


> What is the rationale for not permitting implementations in
> interfaces?

A: Simplicity and future proofing. 

The hard requirement for interfaces (when they were conceived in AS3 at
Macromedia/Adobe) was to be able to relate a class to one or more
"abstract" types (as in Java). We discussed a richer idea of interfaces
that would allow add implementation, etc, but were forced by design and
practical concerns to choose a minimalist solution that would allow for
future growth.

But how do interfaces related to traits? To quote your reference
(http://www.iam.unibe.ch/~scg/Research/Traits/): "Unlike mixins and
multiple inheritance, Traits do not employ inheritance as the
composition operator. Instead, Trait composition is based on a set of
composition operators that are complementary to single inheritance and
result in better composition properties." 

They sound to me to be orthogonal, at least in form if not in function.

Jd



> -----Original Message-----
> From: es4-discuss-admin at mozilla.org
[mailto:es4-discuss-admin at mozilla.org]
> On Behalf Of P T Withington
> Sent: Thursday, August 24, 2006 10:53 AM
> To: es4-discuss at mozilla.org
> Subject: Interfaces without implementation are like a day without
sunshine
> 
> What is the rationale for not permitting implementations in
> interfaces?  One of my primary gripes with interface in Java is that
> typically means you are going to have to write the same
> implementations over and over and over, with the risk that one of
> your implementations may skew.
> 
> Why not allow implementation in interfaces as a way to package a unit
> of functionality that can be shared by a number of classes?
> 
> (There is a good overview of this pattern at http://www.iam.unibe.ch/
> ~scg/Research/Traits/.  Note that the 'traits' here are different
> from the ES4 use of trait in the specification.)
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss




More information about the Es4-discuss mailing list