LWN.net Logo

The Chromium Blog on the future of JavaScript

The Chromium Blog has an overview of the new JavaScript features expected in a major revision of the language next year. "A proxy simulates a JavaScript object or function, and can customize just about any aspect of their behaviour that you can imagine. This is a real power feature, that takes reflection to a new level and can be used to implement various advanced abstractions and interfaces."
(Log in to post comments)

The Chromium Blog on the future of JavaScript

Posted Feb 11, 2012 3:12 UTC (Sat) by kripkenstein (subscriber, #43281) [Link]

This definitely shouldn't be "next year" - it should be this year. Firefox has had these features for a while, and with Chrome adding them now, other browsers will probably follow them pretty soon.

I'd be surprised if we can't start to use these features - on most modern browsers - later this year.

These features are available now

Posted Feb 11, 2012 3:52 UTC (Sat) by samth (subscriber, #1290) [Link]

The editor is confusing when the language standard will be released (end of 2013, probably) with when these features are available. This blog post is announcing that they're implemented in Chrome Dev Channel *right now*, and the same features are already available in Firefox as well.

Javascript for everyday use

Posted Feb 11, 2012 16:23 UTC (Sat) by epa (subscriber, #39769) [Link]

Javascript is evolving into a nice language and it certainly gets more manpower spent on a fast runtime than other scripting languages get. Is anyone using it for general purpose scripting to replace Perl, Python, Tcl and so on?

Javascript for everyday use

Posted Feb 11, 2012 17:20 UTC (Sat) by mathstuf (subscriber, #69389) [Link]

GNOME and Qt/KDE are last I heard.

Javascript for everyday use

Posted Feb 12, 2012 3:24 UTC (Sun) by cmccabe (guest, #60281) [Link]

Well, there's node.js, for what that's worth.

Javascript for everyday use

Posted Feb 12, 2012 12:35 UTC (Sun) by robert_s (subscriber, #42402) [Link]

"Javascript is evolving into a nice language"

I would argue that it is still a very very long way from such.

I code in python and javascript every day and every time I switch to javascript I still want to cave my brain in.

Javascript for everyday use

Posted Feb 12, 2012 14:53 UTC (Sun) by Lennie (subscriber, #49641) [Link]

If your use-case fits what Douglas Crockford calls "the good parts of Javascript" then the language fits pretty good.

Blame the other parts on Netscape (for the short deadline) and Microsoft (for putting it in the standard).

The environment it runs in most of the time, the browser, is the really ugly part. It is also the reason why JavaScript hasn't had much evolution. It had to remain compatible with old browsers.

Javascript for everyday use

Posted Feb 12, 2012 18:21 UTC (Sun) by robert_s (subscriber, #42402) [Link]

"If your use-case fits what Douglas Crockford calls "the good parts of Javascript" then the language fits pretty good."

Yes, I've watched Crockford's lectures, and yes, he is very convincing.

But then you go and try and work with javascript in a large-ish project and you realize the prototype based object model is Just Not Good Enough. It is not _just_ because we are all "brainwashed into thinking the 'classful' object is the only way to do things" that 90% of coding gets done in what Crockford would call classful languages. It's just a pattern that works really well. And most of us everyday programmers are used to it and know how to get it to fly.

And I realize it's technically possible to fake most classful behaviour with prototypes, but often these hacks are really very verbose and awkward.

And "the good parts" of javascript obviously don't involve manipulating strings or arrays, because the primitives for doing this are just plain awful. The documentation for these functions is chock full of mad caveats.

And even with the modern improvements (which I'm not sure I'll really be able to _use_ for a good few years), things don't go far enough. Case in point, the new collections: "(Caveat: Iteration over collections is not yet specified.)". Just bloody great.

"Blame the other parts on Netscape (for the short deadline) and Microsoft (for putting it in the standard)."

I'm not looking for anyone to blame, I'd just really rather not have to deal with this crap when python only ever seems to get neater. People who voluntarily code in javascript when they don't have to (node.js users) seem totally bananas to me.

Javascript for everyday use

Posted Feb 12, 2012 21:19 UTC (Sun) by Lennie (subscriber, #49641) [Link]

I've done large projects, it is possible.

The problem is you first need to learn what not to do.

The good thing is, the number of things you shouldn't do is getting less each and every year.

It is kind of like you shouldn't try to implement rounded corners for a site in IE6. Just implement it in the way it works in newer browsers, old browsers don't need rounded corners to display a site and will ignore what the new browsers do understand.

You need a different mindset and use what is possible, not try to go against it.

Many programmers struggle with the mindset.

Javascript for everyday use

Posted Feb 13, 2012 15:51 UTC (Mon) by robert_s (subscriber, #42402) [Link]

"I've done large projects, it is possible."

Possible.

Fun?

Elegant?

"You need a different mindset and use what is possible, not try to go against it."

Well, I've tried a significant amount to adhere to the prototypes model, but frankly I'm not going to throw out a couple of hundred good coding habits I've got into in order to learn a method I'm not at all convinced is really any better.

You need to get into a different mindset to code well in Forth too. But that doesn't mean I'm going to or that I would advise anyone to.

Javascript for everyday use

Posted Feb 13, 2012 10:56 UTC (Mon) by epa (subscriber, #39769) [Link]

If you are programming for the local machine, rather than scripting Web pages, then you don't have to wait long for the new features. You can use them as soon as your preferred Javascript engine supports them.

Javascript for everyday use

Posted Feb 13, 2012 15:53 UTC (Mon) by robert_s (subscriber, #42402) [Link]

True I'm sure, but if you read my comment I'm saying that _even then_, the new language features have absurd limitations and quirks in comparison to, in this case, python.

Javascript for everyday use

Posted Feb 16, 2012 7:36 UTC (Thu) by ceplm (subscriber, #41334) [Link]

I have developed and maintained couple of thousand lines long JavaScript project (a Firefox addon written with Add-on SDK) and now I have switched (due to work-related issues) back to Python. It's like coming home. And it is not because of language, but the difference is (as with nearly all language-related issues) in the standard library and tools. JavaScript's standard library (even with Add-on SDK, which helps a lot; and no jQuery is a not solution, but one of the biggest problems) is something between non-existent and awful, and tools .... oh well. Only when I started to debug a rather large Python program with a real debugger I recognized what I was really missing ... support tools.

JavaScript has some nice parts, but generally it has a long long way to go.

JavaScript Semicolon Brain-Damage

Posted Feb 13, 2012 11:24 UTC (Mon) by ldo (subscriber, #40946) [Link]

If they only allowed Python-style line continuations, I could forget the horror that is the JavaScript semicolon convention. Currently this will work:

    a =
        (
            b
        +
            c
        +
            d
        )

but I cannot do the equivalent of this Python layout:

    TheItem.add_accelerator \
      (
        accel_signal = "activate",
        accel_group = AccelGroup,
        accel_key = ord(AccelKey),
        accel_mods = gtk.gdk.CONTROL_MASK,
        accel_flags = gtk.ACCEL_VISIBLE
      )

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds