Brendan Eich Explains ECMAScript 3.1 To Developers
VonGuard writes "On April 9, ECMA International produced the final draft for the first major update to JavaScript since 1999. It's called ECMAScript 3.1, but will soon be known as ECMAScript, Fifth Edition. You'll know it as JavaScript, the Next Generation. Mozilla will begin implementing these features after Firefox 3.5, and Microsoft is already showing prototypes behind closed doors. The question, however, is what this will change for JavaScript coders. To get those answers, I tracked down Brendan Eich, Mozilla's CTO and the creator of JavaScript. I transcribed the interview without any editorial since he explains, perfectly, what's changing for programmers. Long story short: Json will be safer, getters and setters will be standard, and strict mode will make things easier to debug."
Even if it continues to cause confusion with "Java", I'm not going to call it ECMAScript because it sounds like a skin disease Eczema script
With Microsoft cooperating to improve the language, now we can move on beyond the fifth edition, toward ECMAScript harmony.
Microsoft? Cooperating? Whatever happened to Embrace, Extend, and Extinguish? How can we keep hating on Microsoft if they're going to cooperate?
John
From TFA, it sounds like they are moving a lot of the stuff you normally find in the more popular libraries into the language itself. That makes sense, but hardly a game changing innovation that web application development companies should be gearing up for.
ECMA, you mean the Oooopen XML ISO fast-track scam machine "ECMA International".
Why don't they publish the specification on their servers down in Redmond instead? Do the standard developers have a girl friend in Geneva? Or do they think it is more fun with free beer parties with Mozilla?
And finally, what has the current hugging to do with what goes on in Brussels?
FTA: A lot of JavaScript is forked. If the DOM is IE, use this version of the code, otherwise use this.
Until this changes throughout the entire web, ECMAScript will only be that other part of css. It's just too problematic to have to code separate DOM funtionality for every browser on the market.
Will ECMAScript ever become sane to do OOP in?
Here's how you create an instance of a class in ECMAScript.
You start by creating a function (function foo). This will serve as the constructor. Why a function? Because EVERYTHING in ECMAScript is an object, even a function. But hey, why are you using an object instance as a class? Because ECMAScript does it that way.
Then, you take that object and set its 'prototype' member to another object that contains various members (foo.prototype = {var a; var b; var c;}). This is how you declare an object's members-to-be once it's instantiated, in ECMA script.
Finally you say "var bar = new foo();". And bar is an 'instance' of foo.
In short, when will ECMAScript have a way to do OOP that isn't totally retarded?
== Jez ==
Do you miss Firefox? Try Pale Moon.
As long as using jQuery doesn't change, I'm good. :)
I fear for all those poor websites with red backgrounds...
biopowered.co.uk - catalytically cracking triglycerides for home automotive use since 2008. Just say no to big oil!
I'm holding out for ECMAScript 3.11 for Workgroups!
JavaScript does OOP in a sane manner. It's not the same manner as many traditional OO languages, to be true -it's prototype-based instead of class-based- but it's every bit as sane in its own way. It's just different.
The major reason you find OOP in JavaScript to be "insane" is that you are tearing your hair out trying to shoehorn in this particular paradigm that the language wasn't designed to use: sure, you can do it, but it's a lot of extra effort for very little gain in the end. That's not a problem with the language, but with programmers who resist the flow of that language. Just let JavaScript be JavaScript, and you'll find that things get much saner, or at least a lot less maddening.
Seriously: what harm ever came from learning new ways to do things?
Everybody knows TNG just copied half its stuff from the original!
A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
Json has dethroned XML for pure data interchange
</quote>
Somehow I don't think so. "AJAJ" just doesn't have quite the same ring to it.
"No matter how cynical you get, it is impossible to keep up." -- Lily Tomlin
it junst 0wnz.',
Anyone have a link?
Old story, "no it's not java" or "ECMAwhat?"
We get a new rev, add a name change update; let's call it something cool, oh, say ruby++ ?
you should be able to code in straight javascript in all browsers the same. obviously, you can't do that now. but that doesn't justify the existence of libraries, it just means they are temporary bandaids that should go away with the implementation of the next javascript (crossing fingers)
intellectual property law is philosophically incoherent. it is your moral duty to ignore it or sabotage it
The names and version numbers are really confusing. The following is my understanding, which may be wrong -- if so, please correct me.
ecmascript 4==javascript 2==actionscript 3 ... If I'm understanding correctly, this was overambitious, turned out to be a dead end, won't happen.
ecmascript 3.1==ECMAScript, Fifth Edition ... This seems to be the more modest thing that they backed off and got a consensus for instead.
Find free books.
First, JavaScript is a very nice language indeed. If you've never learned functional programming, JavaScript is a good language to learn in. Why? You can actually do real work while learning! As for the new language spec...
Getters and setters are nice, but I'm not sure they serve a purpose in javascript--javascript is more functional than it is OO and I think people learning the language should change mindsets rather than the langage get bastardized to something it is not. I dunno, somebody can challenge me on this.
Good to see they are thinking about adding a "use strict". You aren't an adult language until you have a way to force variable declaration. Hopefully "use strict" will apply to a module or block, not to the entire project. I want to "strictify" my own JavaScript, but I dont want the browser to choke on some sloppy copy-and-paste deal from AdSense or analytics.
Lastly, JSON. There are a couple "gotchas" with it... namely when you generate JSON using a loosely typed language like Perl and try to feed it into a strongly typed language like C# (i.e. silverlight). Depending on the serializer / deserializer used on the strongly-typed side, you'll run into things.
For example, the deserializer in C# just might choke on this: // it will puke on this: // i am a string! // I am a postgresql date, but I'd also barf on ISO8601 // puke free: // I am an int! // i am a legit Date()
"themes": [
{
"theme_id": "34",
"last_mod": "2009-04-09 13:04:27.232-07"
},
{
"theme_id": 34,
"last_mod": new Date(3000, 00, 01, 00, 00, 00)
}
]
Why? Perl serialized the integers as a string. Depending on the deseralizer, it might choke on those strings if it was expecting a number. YUI would also be pissed off about the date not being a javascript Date()--good luck finding a serializer that produces such a thing! My point? These are some surprise gotchas you have to worry about when dealing with JSON. Not sure who is to "blame"--perl for being loosely typed, the deserializers for being to strict. This would be a problem with XML as well though.
aHahahahahahahahahahahahaha. Why it's the best thing about Javascript, writing the same code*browers different ways, and with chrome and safari Javascripting is just gonna get more and more fun. More Fun, MORE F.U.N.
The evil javascript hurts me. Evil I tells you!!!!
My ism, it's full of beliefs.
It sounds like they decided to go with shoring up the language as it is currently used rather than make sweeping new changes. Good for them. I'm not sure if it was Adobe's doing or Macromedia's, but they really threw out the baby with the bathwater with the "transition" from ActionScript 2 to ActionScript 3. Rather than fixing up the obvious problems with AS2, like silently swallowing errors and gaping holes in the functionality of core objects, they abandoned it entirely and replaced it with some bizarre mutant language from a parallel dimension. I still have to wonder why, if they were willing to completely abandon both backward compatibility and developer familiarity, they didn't just decide to switch to an existing language. As far as I can tell, the only thing that AS3 really accomplished was to reimplement Java, and poorly.
For a while, it looked like the next version of JavaScript was following down a similar path. Glad to see that's not going to be the case.
If I don't put anything here, will anyone recognize me anymore?
ECMA script, Java The Next Generation, JSon, WTF? Whatever happened to version numbers?
Currently hooked on AMP
...yes, but, does it work with java?
Good people go to bed earlier.
C# and Perl happen to be also strongly typed and losely typed, respectively, but that isn't essential to your example. The distinction you're looking for isn't "strongly typed" vs "loosely typed", but "statically typed" vs "dynamically typed".
these chaalenges by BSDI who sell Are incompatible
Series of internal have an IRC client www.anti-slash.org ww.anti-slash.org
FTA: A lot of JavaScript is forked. If the DOM is IE, use this version of the code, otherwise use this.
Not much of *Javascript* itself is forked. The *DOM* is quite thoroughly forked. One might even say forked over. But as other people have pointed out, Prototype and Dojo and jQuery and the like tend to mitigate that problem.
Tweet, tweet.
JSON's not always fatter. Particularly when you have information stored as child nodes rather than attribute nodes (one-many relationships rather than one-one relationships tend this way), XML can get fatter pretty quickly.
I suspect the JSON love has to do with the fact that if you're already working in Javascript, it's just more javascript, and there's zero mystery about how to work with it. Not that XML is rocket science, but with JSON, it's pretty much as easy as eval() if you trust the server.
Overall, I like what Steve Yegge had to say: "XML is better if you have more text and fewer tags. And JSON is better if you have more tags and less text." It's probably a little more complicated than that (the fatter/thinner issue is one, compression is another), but it's a decent heuristic.
Tweet, tweet.
You really think I was gonna fill in the guts of a sample function? .click() hooks the onclick event.
{"name":"Jack (\"Bee\") Nimble","format":{"type":"rect","width":1920,"height":1080,"interlace":false,"frame rate":24}}
<o name="Jack ("Bee") Nimble"><format type="rect" width="1920" height="1080" interlace="false" frame_rate="24"/></o>
Anyway, it's a difference of 8 characters in JSON's favor. Unlike XML attributes, no whitespace between JSON properties is necessary. And for that matter, while they can be shoehorned to present the same information, they can serve somewhat different purposes. But really, as a data format, the advantages that JSON sways me with are:
- JSON is identical in text form to the same data structure in JS, which is great since JS is where I do most of my work
- JSON is a hell of a lot more readable, particularly as the data grows (it is also less annoying to write, for whatever little you may be writing either)
- Parsing JSON is dead simple in every language I work with, which is not the case for XML
Yes, it also has marginal bandwidth benefits, but that's not the only thing one looks for in a data format.