>
> var Blah = BaseClass <| function(){}
>
Blah.prototype.{
> a: function(){},
> b: function(){}
> }
>
The point I'm trying to drive home is that the above is no better (worse,
in fact) from a user experience standpoint, than what I have now. To be
blunt, I would not use the above construction - my library's API is better.
> But what I'm trying to understand is the need for classes.
>
There is a school of thought that believes that it is always suboptimal to
express encapsulation and reuse in Javascript in terms of "classical"
classes. I do not subscribe to this belief. Sometimes (but not always)
classes can be the right tool for the job.
ES3/5 gives us a programming model that includes constructors and
prototypes. It does not give us "classes". With constructors and
prototypes, though, we can create classes. I argue that this "stack"
should be maintained. A class syntax would be great, but whether we get it
or not, classes should be an abstraction built on top of constructors and
prototypes. We should not allow class concepts (like super-delegation) to
bleed down into the realm of object literals.
Of course, there's always the possibility that I'm completely wrong or
babbling incoherently to myself. These are the risks one takes...
Thanks again for your time! : )
kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss