On Jul 18, 2011, at 4:50 PM, Bob Nystrom wrote:

> On Mon, Jul 18, 2011 at 3:40 PM, Allen Wirfs-Brock <al...@wirfs-brock.com> 
> wrote:
> On Jul 18, 2011, at 1:05 PM, Bob Nystrom wrote:
>> 2. Familiar from other languages and it works about the same here as it does 
>> in those
> Arguably it doesn't.  Java/C# static methods are not 
> inherited/over-ridable...of course that leads to the issue of 
> constructor-side inheritance.
> I did say "about the same" and not exactly the same. Naturally there are some 
> differences, but there are plenty of similarities too. I don't think a 
> programmer from C++/C#/Java would find this astonishing at all, and would 
> probably have little trouble inferring what it means:
>   class Point {
>     static zero() { return new Point(0, 0); }
>   }
>   var p = Point.zero();

Indeed, isn't that legal C# 4.0? :-P

>> 1. We want to re-use keywords from other languages to make JS familiar and 
>> to use what's already in the programmer's head. If some JS construct looks 
>> and acts similar to a construct in other popular languages, using the same 
>> word for it is like instant knowledge.
> I don't think we have listed this as a design guideline anywhere.
> Does it need to be written down as a guideline to be a good idea?


I've been on this side since ES4 days. I'm a bit older and wiser, so I'll just 
add that it takes nice judgment and experience to know when to imitate and when 
to diverge.

It's clear classes are not quite complete or coherent for ES.next, even though 
the proposal has been accepted (too many open issues, some not recorded). 
Imitating another language won't settle the open issues. We need to focus on 
specifics and simplify if possible, cut if necessary.

> If a word/constructor looks the same or even similar but has different 
> semantics we have instance confusion rather than instant knowledge.
> We don't have to look familiar to get people to use JavaScript.  They are 
> going to use it regardless.
> That's probably true (yay browser lock-in) but I don't know that's what I'd 
> call a great attitude for usability. I'm imagining that as a bumper sticker. 
> JavaScript: you're going to use it regardless.

I'm with Bob here.

Word on the street, from folks ranging the skill gamut, is that <|, <& and so 
on are Perl-ish line noise. We should consider alternatives, even if it means 
restricted productions.

> The primary purpose of a class is to define the behavior (methods) of 
> instances. It is describing an abstraction over all the possible instances. 
> The behavior of the singleton class object is typically secondary to the 
> primary abstraction.
> True, but secondary still matters.

Here you were arguing about class vs. prototype method indentation or body 
nesting level? I could see us making a subordinate body for class methods, 
instead of using 'static'.

es-discuss mailing list

Reply via email to