On 13.09.2010 21:13, Mark S. Miller wrote:
Responding to Brendan's challenge at <https://mail.mozilla.org/pipermail/es-discuss/2010-September/011825.html>, I've been working up <http://wiki.ecmascript.org/doku.php?id=strawman:syntax_for_efficient_traits>. Given the revival of that thread today, now seems like an opportune time to post it.

Seeing as how classes-as-sugar is getting a much cooler reception on the list than traits, if there are no objections, I propose to use the timeslot on the agenda currently reserved from classes-as-sugar to instead discuss traits and traits vs classes-as-sugar.

"Syntax for Efficient Traits" at <http://wiki.ecmascript.org/doku.php?id=strawman:syntax_for_efficient_traits> is now ready for discussion.

I didn't finished a detailed reading yet, but from the brief scanning, syntactically, I think /=>/ and /trait class/ are not needed.

/trait class EnumerableTrait() => {/

instead better:

trait Enumerable {

/class Interval(min, max) => {/

instead better:

class Interval(min, max) {

or even (with initialize method)

class Interval {
  function initialize(min, max) {}
}

Superfluous symbols are not needed.

And still, don't forget about the (vertical) inheritance, i.e. class Foo may /extends/ Bar. If there will be no (delegation based) inheritance, such classes won't be needed, because they will be just casual pattern-factories. In addition, mixins/traits, being a horizontal inheritance (the augmentation of the vertical code reuse) are also good to have as delegation based. I think that you (and Tom) used statically augmented (a method per instance) object not because you like it ideologically, but because it's not possible to implement it cross-browser in nowadays.

Dmitry.



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to