+1. Very nicely put.

/be

On Jun 13, 2011, at 11:51 AM, Bob Nystrom wrote:

> On Sun, Jun 12, 2011 at 2:38 PM, Brendan Eich <bren...@mozilla.com> wrote:
> Something about classes in JS makes me sad, an emotional effect I can't 
> explain fully.
> 
> <philosophical>
> 
> I'm one of the biggest fans of this class proposal, and I feel a twinge of 
> that sadness too. I look at it as JS taking a step away from Scheme and 
> towards Common Lisp.
> 
> I think one of the big reasons people love Javascript is that it has the same 
> appeal of old school LEGOs: it gives you just a few kinds of pieces but you 
> can combine them in a huge variety of fashions to make all sorts of novel 
> things. Adding class syntax feels a bit like how LEGO pieces started to get 
> more specialized.
> 
> As a creative-at-play, specialization like that sucks. You're taking away my 
> ability to invent something new and replacing it with some ready-made thing 
> that I can't modify. However, as a pragmatic person trying to get work done, 
> this a win. If it's my job to make LEGO cars, a prebuilt chassis makes my job 
> easier and faster.
> 
> Since JS is used by working programmers who just want to ship solid code, I 
> think it's helpful to have features like this that encode common patterns and 
> make them easier to express. I look at class syntax as a pre-built kit for 
> the kinds of things we find ourselves having to make from scratch over and 
> over again. That's great because, honestly, I'm not innovating on "how to 
> define reusable kinds of entities" in JS everyday. I mostly follow the same 
> constructor+prototype pattern that many of us do. So if I can have an 
> ready-to-use syntax for that, it means less time typing that boilerplate over 
> and over, and more of my time spent on the things I am innovating on: user 
> experience, libraries, etc.
> 
> At the same time, it's worth remembering that class syntax doesn't take any 
> toys away from you. You still have all of the JS primitives you know and love 
> to play with, and if classes aren't a good fit for you, you're always free to 
> go your own path. In that sense, they're more like classes in C++ than Java: 
> they enshrine a common pattern but don't rebuild the entire language around 
> them. Like C++, you can use them where they make sense and not where they 
> don't.
> 
> </philosophical>
> 
> In part I think class is the wrong word, as cowboyd tweeted (see below).
> 
> Agreed. "class" isn't ideal, but it's probably the best we have. It carries a 
> lot of baggage, some of which is helpful and some of which isn't. I think 
> most of the pragmatic baggage is helpful (things you make with this class 
> proposal behave pretty similarly to classes in other languages) but the 
> conceptual baggage isn't: people hear "class" and think we're trying to turn 
> JS into Java, which for many is a short hop away from COBOL and having to 
> wear a suit to work. No one wants that to happen to JS.
> 
> - bob

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to