Property vs Behavior inheritance
bruant.d at gmail.com
Fri Dec 16 05:00:14 PST 2011
Le 15/12/2011 23:38, John J Barton a écrit :
> On Thu, Dec 15, 2011 at 10:58 AM, David Bruant <bruant.d at gmail.com
> <mailto:bruant.d at gmail.com>> wrote:
>> Classless solutions need a compelling solution to this issue,
>> that is, an operation on a list of vanilla objects that yields a
>> class-like object. Any such operation will fail in some cases,
>> just like class-based solutions fail sometimes (when you really
>> want to share data across classes). But a solution is needed for
>> the 99% of the time when you don't want data sharing.
> I agree with your intention, but not your conclusion. The language
> provides a very generic interface when it comes to composition.
> Between selfish, what WebIDL does and traits, we have at least 3
> different relevant approaches to composition, why should the
> language pick one over all those possible?
> Because practical experience shows that one approach has applies to
> many more cases than other approaches.
I think that practical experience is biased. IE6/7/8 do not have any
mecanism to define accessors.
Lack of private properties forced to either put all properties as public
for them to be used by prototype method or to duplicate methods at the
base level. I personally do the latter, because I care about
encapsulation. My practical experience in how I organise my objects is
biaised by something missing in the language.
> However, I did not advocate for one approach to composition. Rather I
> am seeking a way to deal with data-properties in a classless
> composition. The operator |> solves one part of the inheritance
> problem, the part where vtables point to base class vtables. It does
> not solve the other parts and I don't recall reading about these other
> parts outside of solutions based on classes.
> ...an operation on a list of vanilla objects that yields a class-like
Are you asking for built-in support for "mixins"?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss