Re: How to fix the `class` keyword (Brendan Eich)

2015-03-05 Thread Eric Elliott
In case it helps, the idea mooted for ES7 is that you'd add a call handler to the class for when it is invoked without `new`: class Point2D { constructor(x, y) { this.x = x, this.y = y; } [Symbol.call](x, y) { return new this.constructor(x, y); } ... } I used

Re: es-discuss Digest, Vol 97, Issue 31

2015-03-05 Thread Eric Elliott
5. Re: How to fix the `class` keyword (Allen Wirfs-Brock) One of those possible enhancement that has been talked about is to implicitly treat a [[Call]] of a class constructor as an implicit 'new', just like you are suggesting. Doesn't this need to be configurable, and Brendan Eich

How to fix the `class` keyword

2015-03-04 Thread Eric Elliott
I've already posted this on my Medium blog here: https://medium.com/@_ericelliott/how-to-fix-the-es6-class-keyword-2d42bb3f4caf It seems inevitable that the `*class*` keyword in JavaScript is going to catch on, but that’s a problem because it’s fundamentally broken in many ways. Now that it’s

Array.prototype.contains

2014-03-05 Thread Eric Elliott
What ever happened to Array.prototype.contains? There's an old strawman for Array.prototype.has ( http://wiki.ecmascript.org/doku.php?id=strawman:array.prototype.has ) that references this thread: ( https://mail.mozilla.org/pipermail/es-discuss/2012-February/020745.html ) But it seems the thread

Re: Array.prototype.contains

2014-03-05 Thread Eric Elliott
at 2:07 AM, David Bruant bruan...@gmail.com wrote: Le 05/03/2014 09:24, Eric Elliott a écrit : What ever happened to Array.prototype.contains? There's an old strawman for Array.prototype.has ( http://wiki.ecmascript.org/doku.php?id=strawman:array.prototype.has ) that references this thread

Re: Another switch

2014-02-21 Thread Eric Elliott
when you're switching on something with a meaningful conversion to string. On 20 Feb 2014, at 21:20, Eric Elliott e...@ericleads.com wrote: Object literals are already a great alternative to switch in JS: var cases = { val1: function () {}, val2: function () {} }; cases[val

Re: Another switch

2014-02-20 Thread Eric Elliott
Object literals are already a great alternative to switch in JS: var cases = { val1: function () {}, val2: function () {} }; cases[val](); Fall through is more trouble than it's worth, IMO. On Feb 17, 2014 1:44 PM, Giacomo Cau cau.giacomo...@tiscali.it wrote: -Messaggio

Re: Classical inheritance is obsolete

2013-06-30 Thread Eric Elliott
Brendan, You seem to only be replying to the most recent comment in this thread, and not considering the objections that I raised at the beginning of the thread. My argument is that class isn't just a little bit of sugar. I believe that counter to its goal, it will reduce programmer productivity

Re: Classical inheritance is obsolete

2013-06-30 Thread Eric Elliott
JS is a rich language that allows different styles of programming. Nothing wrong with that. What's wrong is that when we give people `class` and `extends`, books and blog posts everywhere will begin to teach that this is how we do inheritance in JavaScript, ignoring all the perils that go with

Re: Classical inheritance is obsolete

2013-06-30 Thread Eric Elliott
about it. - Eric On Sat, Jun 29, 2013 at 7:07 PM, Axel Rauschmayer a...@rauschma.de wrote: On Jun 29, 2013, at 20:12 , Eric Elliott e...@ericleads.com wrote: If I were advertising, there are better places to do it, and better ways. I feel like adding class to JS would be detrimental

Re: Classical inheritance is obsolete

2013-06-30 Thread Eric Elliott
Honest question: how can this problem not be solved via ES6 classes plus mixins? The original hierarchy already feels wrong. Why not create a super-class Animal, with sub-classes Human, Ape, Bird, Bee, Fish, Whale plus the mixins Walking, Flying, Swimming? I completely agree with you, but in the

Re: Classical inheritance is obsolete

2013-06-30 Thread Eric Elliott
inherited pieces. That skeleton doesn’t even have to be a hierarchy, it could be a set of classes. Maybe you simply need to write a mixin or trait library that works well with ES6 classes? Axel On Jul 1, 2013, at 0:22 , Eric Elliott e...@ericleads.com wrote: Honest question: how can this problem

Re:

2013-06-29 Thread Eric Elliott
/69255635 3) Are there specific points that you disagree with? - Eric On Sat, Jun 29, 2013 at 7:11 AM, Alex Russell slightly...@gmail.com wrote: On 28 Jun 2013 19:31, Eric Elliott e...@ericleads.com wrote: I'm not here to discuss the mechanics of what class does. I'm just saying we

Re:

2013-06-29 Thread Eric Elliott
even if you start out using class inheritance, it can be problematic to switch to mixins and similar strategies down the road. - Eric On Fri, Jun 28, 2013 at 7:41 PM, Claude Pache claude.pa...@gmail.comwrote: Le 29 juin 2013 à 00:14, Eric Elliott e...@ericleads.com a écrit : snip I saw

Re:

2013-06-29 Thread Eric Elliott
it. On Jun 29, 2013, at 8:58, Eric Elliott e...@ericleads.com wrote: Hi Alex, Your response is extremely vague. It doesn't seem to say more than I think you're wrong. Oh, and lots of other people think you're wrong too. 1) Who are these many who disagree with the potential for harm? Can you

[no subject]

2013-06-28 Thread Eric Elliott
I know this has been batted around already. I know everybody's totally stoked about class sugar in ES6. I just wanted to register my protest. I made my arguments in this talk at Fluent: http://ericleads.com/2013/06/classical-inheritance-is-obsolete-how-to-think-in-prototypal-oo/ I'm already

Re:

2013-06-28 Thread Eric Elliott
a video, I guess the conversation is over. =) - Eric On Fri, Jun 28, 2013 at 10:45 AM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Fri, Jun 28, 2013 at 10:42 AM, Eric Elliott e...@ericleads.com wrote: I know this has been batted around already. I know everybody's totally stoked about class

Re:

2013-06-28 Thread Eric Elliott
- http://davidwalsh.name/javascript-objects (3 parts) - Eric Elliott On Fri, Jun 28, 2013 at 11:40 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Fri, Jun 28, 2013 at 11:31 AM, Eric Elliott e...@ericleads.com wrote: I'm not here to discuss the mechanics of what class does. I'm just saying we

Re:

2013-06-28 Thread Eric Elliott
in JavaScript. The problem isn't with the ES6 implementation. It's the whole paradigm. - Eric On Fri, Jun 28, 2013 at 2:27 PM, David Bruant bruan...@gmail.com wrote: Hi Eric, Le 28/06/2013 19:42, Eric Elliott a écrit : I know this has been batted around already. Has it? :-p I know

Re:

2013-06-28 Thread Eric Elliott
. JavaScript is confusing enough to people without adding `class`. Sometimes giving people more choice is a bad thing: http://www.amazon.com/The-Paradox-Choice-More-Less/dp/0060005696 - Eric On Fri, Jun 28, 2013 at 3:55 PM, David Bruant bruan...@gmail.com wrote: Le 29/06/2013 00:14, Eric Elliott a écrit

Re:

2013-06-28 Thread Eric Elliott
for preaching to the choir and/or ruffling feathers DFKaye -- *From:* David Bruant bruan...@gmail.com *To:* Eric Elliott e...@ericleads.com *Cc:* es-discuss es-discuss@mozilla.org *Sent:* Friday, June 28, 2013 3:55 PM *Subject:* Re: Le 29/06/2013 00:14, Eric