Property vs Behavior inheritance

2011-12-15 Thread John J Barton
(I know the language experts know all this, I'm spelling it out for fellow amateur 'classless' fans) After using (and liking) selfish I understand why prototypical inheritance via simple references is not an effective alternative to classes. The new Foo/Foo.prototype JavaScript idiom sets up a lo

Re: Property vs Behavior inheritance

2011-12-15 Thread Axel Rauschmayer
[[Prototype]] -> [[Prototype]] --> [[Prototype]] ---> null myProps | parentProps grandProps | | [[Prototype]] + myProps > But once we use these classes to create instances, those instances will very > likely have data. Thus

Re: Property vs Behavior inheritance

2011-12-15 Thread David Bruant
Le 15/12/2011 18:17, John J Barton a écrit : > (I know the language experts know all this, I'm spelling it out for > fellow amateur 'classless' fans) > > After using (and liking) selfish I understand why prototypical > inheritance via simple references is not an effective alternative to > classes.

Re: Property vs Behavior inheritance

2011-12-15 Thread John J Barton
On Thu, Dec 15, 2011 at 9:51 AM, Axel Rauschmayer wrote: > A naming convention is not enough? Right now that works reasonably well > for “functions versus constructors”. > My assessment differs: "The capital-letter constructor solution works well for a single level of inheritance in simple syste

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
> With object exemplars, you have: > > var jane = new Person("Jane"); > var Employee = Person <| { ... }; > > (Since I guess only long time readers of this newsgroup could understand what > you write above, let me give a capsule summary: > Employee becomes an object with a .prototype pro

Re: Property vs Behavior inheritance

2011-12-16 Thread David Bruant
Le 15/12/2011 23:38, John J Barton a écrit : > On Thu, Dec 15, 2011 at 10:58 AM, David Bruant > 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.

Re: Property vs Behavior inheritance

2011-12-16 Thread John J Barton
On Fri, Dec 16, 2011 at 4:22 AM, Axel Rauschmayer wrote: > ... > How you work with object exemplars is almost like with classes: You have > to be aware which objects are exemplars and which ones are instances. A > useful sanity check could be to require an exemplar to have a constructor() > metho

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
> I'll just re-state this paragraph to illustrate that the glass is half empty: > > Unlike classes, object exemplars are just objects. There is no language > support for detecting a object exemplar; developers have no help in avoiding > pernicious debilitating bugs caused by data values in base

Re: Property vs Behavior inheritance

2011-12-16 Thread John J Barton
On Fri, Dec 16, 2011 at 7:42 AM, Axel Rauschmayer wrote: > I'll just re-state this paragraph to illustrate that the glass is half > empty: > > Unlike classes, object exemplars are just objects. There is no language > support for detecting a object exemplar; developers have no help in > avoiding p

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
> Sorry I don't understand the question, or how it is related to my > quest. I would argue that your quest can be fulfilled by class declarations that desugar to object exemplars. Do you agree? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ali

Re: Property vs Behavior inheritance

2011-12-16 Thread John J Barton
On Fri, Dec 16, 2011 at 9:01 AM, Axel Rauschmayer wrote: > Sorry I don't understand the question, or how it is related to my > quest. > > > I would argue that your quest can be fulfilled by class declarations that > desugar to object exemplars. Do you agree? > Assuming that your class declaratio

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
> I would argue that your quest can be fulfilled by class declarations that > desugar to object exemplars. Do you agree? > > Assuming that your class declarations resemble say Java's, then of course. > But if we have class declarations like Java's why do we care about object > exemplars? Beca