Web 2.0, Meet JavaScript 2.0
Jeremy Martin writes "Well I suppose it's an undeniable fact about us programmer-types — every now and then we just can't help but get excited about something really nerdy. For me right now, that is definitely JavaScript 2.0. I was just taking a look at the proposed specifications and I am really, truly excited about what we have coming."
Does it have 33% more bugs than v1.5?
Not really exciting.
.NET framework on the client side. Doesn't get much better than that.
I've been playing around with Silverlight though, now THAT's where the future lies. You get the majority of the
Yes, we are nerds. But do you really have to rub it in?
but what about more meaningful(detailed) errors?
Operator overloading? Great, now you can enjoy C++ style code, where left shift and print are the same command.
All of the proposed changes are a step backwards. JavaScript is currently a language with great, clean, semantics and slightly ugly syntax. They want to make the semantics less clean and the syntax even more horrendous.
I am TheRaven on Soylent News
These new features are nice and all, but what I really want as a Web developer is for a Javascript standard thorough and widespread enough that I can write scripts that work on most browsers without a bunch of hacks to make sure that each browser gets the right code. Anyone have a prognosis on this?
... soon.
Yet Socrates himself is particularly missed.
A lovely little thinker but a bugger when he's pissed.
alert("keep it simple");
I am getting the impression that JavaScript 2.0 is slowly heading into the direction of Java by adding all those new features. I would not be surprised if the next step will be "pre-compiled" script modules, just like the Java .class files. Adding features to an already existing language is not always making a language better.
just curious.. are you referring to actual differences in how javascript is handled, or in how things like DOM access/structure (page layout scripting and such) are handled per browser?
The latter having nothing to do with the actual javascript syntax, semantics... i.e. the language
As long as I can keep using Prototype as a framework I'll be happy.
As for specific features. I'm looking forward to cleaner and easier to manager asyncronous AJAX. While the client requesting from server has been well thought out, the server sending to the client is still very patchy and not particularly easy to develop for.
It would be nice if I could create socket connections with AJAX to say IRC but still go over HTTP proxy.
I'd also like to see AJAX file uploads that don't have to run through Flash. I think FF3 supports this already.
It's all well and good that there's new language features spec'd out, but JavaScript, at least its most common usage (web client-side) has the distinct disadvantage of lowest-common-denominator. Yes, you have JavaScript 2.0 in all it's less-horrbily-broken splendor, and you may even get Mozilla, Opera, Safari to implement it mostly correctly reasonably soon. Hell, you might even get Microsoft to include a halfway-compliant version in IE 8 or 9 (complete with a few proprietary extensions). But you'll still need to support IE 6 for a year or so and then IE 7 support will be necessary until at least 2012.
By the time JavaScript 2.0 is available in nearly all browsers you find in the wild, there will already be a JavaScipt 4.0 spec out and you'll be able to write this exact comment with the dates and browser versions updated.
The point being that client-side programming is a complete mess right now. Instead of new versions of scripting languages, we should be pushing browser makers to allow scripting to be installed via plug-ins rather than being native to the browser. That way, a website can trigger the user to update to the latest version of the language spec (ala the much-maligned-here flash plugin). That should also allow website authors to use any language, not just JavaScript. After all, if you're developing your site in RoR, wouldn't it be easier to use Ruby for the client-side scripting as well as the server-side? The same would go for Python, Perl, PHP (/me shudders) or even Java/Groovy.
But as long as we are beholden to the browser manufacturers to release updates of their browsers in a timely and compliant manner, we'll be stuck in this cycle where we can't use the latest-and-greatest features until they're no longer latest-and-greatest.
"Don't blame me, I voted for Kodos!"
Okay, look... Javascript isn't horrible for static pages. But sometime in the mid to late 90's the server side of things started taking a lot more importance, and javascript was not really suited to deal with this. Sure, it could be hacked to work. We now even have standard methods for implementing this horrible solution in ways that only occasionally make web developers want to pull their hair out. But really, when I think about what's involved in web programming, we have: 1.) A markup language for the layout of the pages (XML, HTML, DHTML, etc.) 2.) A language to manipulate that markup on the client side (javascript) 3.) A language to manipulate that markup (and the client language code) on the server side (PHP, ASP.NET, Ruby, etc.) 4.) (usually) a database language (SQL) Can't we eliminate at least one of those? I really feel like we should have the same language running on the server as on the client. I personally would prefer python, but I don't really care what language it is. I'm just tired of the inconsistency.
Reading the article I found "Program Units" to be interesting. Most importantly, how does the running program know that the downloaded script is safe? At first glance it appears that one could easily inject malicious script via a man in the middle attack. Now I'm sure that the designers have thought about this so my question is, how does JavaScript 2.0 protect against this?
William
Yet another example of buggy/horrible technology which has prevailed due to backwards compatibility. The future should be browsers that can be extended with various scripting languages.
Yes, I'm aware of NoScript and similar add-ons, and I'm happily using them. That helps, but there's still too much bad and ugly stuff out there to be happy about anything good that JS can do.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
Making javascript more like java is not what I would consider an improvement.
I know I'll be coding for the "vast minority" of people still using Internet Explorer 6 while refusing to upgrade for the best part of this decade. Why do people buy a new mobile phone every year, but keep the same browser they got with their computer back in the late 90's?
I'm predicting "NoScript 2.0" :-)
It must have been something you assimilated. . . .
Most javascript is written by developers that are not using self like languages on the back end. Making the two more similar should allow more developers to write more complex javascript.
And in my book having more javascript is the huge step backwards.
Well.. maybe. Or Maybe not. But Definitely not sort of.
For those who didn't RTFA, it should be noted that Javascript 2.0 is actually ECMAScript 4.0 (ES4). Even if IE9 and FF4 supported ES4 completely, we'll still have to develop for the legacy browsers! Oy vey! Such is the life of a front-end web developer!
That being said, Flash Actionscript 3.0 (available now) includes many of the new features found in ES4 such as real classes. The next version of Actionscript will most likely be ES4-compliant.
Notable features in ES4 include:
- Classes and interfaces
- Generics
- Packages and namespaces
- Compile-time type checking
- Constants
- Operator overloading
- Record types (i.e., structs or light-weight classes)
- Typed arrays and hash maps
- Iterators
- Exceptions
More info: http://www.ecmascript.org/es4/spec/overview.pdf
Actually, if you consider Python to be the opposite of Java (and I very nearly do), just the opposite is happening. Because Javascript is changing into Python, and this makes me happy.
There are indeed many Java-y features being added, such as "use unit" and classes, but these are also Python features. The one feature I saw from the article that looked distinctly Java-ish was static type checking at compile time, and Python will have something similar by the time JS 2.0 is generally usable (i.e. both are optional).
Features in nearer-term versions of JS are even more obviously Pythonic, though. Generators and tuple unpacking, for example.
I'll lay my cards on the table and say that I think Java makes programming laborious and unpleasant, and Python does just the opposite. These features don't seem to make JS any more programmer-unfriendly, and they add a lot, so I'm looking forward to Pythonic JS 2.0.
It's rare that you're presented with a knob whose only two positions are Make History and Flee Your Glorious Destiny.
Q: "If you could do Java over again, what would you change?"
James Gosling: "I'd leave out classes!"
The functional/prototype hybrid in Javascript was a little odd and hard to get used to, but once I did, I've found I like it better than a Class model. Interface/implementation works for me too, but especially in Javascript, I never feel like I really need that fancy keywords to get that done.
There's an awful lot of serious work in the Java community, but I sometimes feel like a lot of *common* practices have evolved because people condensed "best practices" into a formula without disseminating the principles behind them, and it's ended up becoming a lot of busywork. Now it's filtering out to languages like PHP and Javascript that apparently want to grow up to be like Java.
I take some comfort in the fact that there will almost certainly have to be a backward compatibility layer for a long time. And I like the idea of units and constants and namespaces. But I'm not sure this is Javascript anymore, and I'm pretty certain it's not a step forward for the language.
Tweet, tweet.
I think that this new revamped javascript might really cause me some irritation down the track. I'm all for cleaning up javascript a little, but OOP? Does it really need it? I guess there might be a place for it with AJAX apps, but most javascript work is for really simple little functions like checking form input before submitting - and it has been great for that.
For so long, I've been recommending to people who want to learn to program to start with javascript because it is syntactically lenient and has a very quick learning curve (if you know even a little HTML). I'd say leave Java's jobs to Java. Javascript has an entirely different purpose IMHO.
Censorship is the opposite of education. If neo-darwinism were defensible, people would not need to try and censor ID.
I agree with Gosling. Classes are an unnecessary abstraction layer. Why shouldn't you be able to inherit from any object?
Instead of writing specs in essay form & expecting someone else to translate them into software, why can't these guys just write the spec in the form of the software to actually implement it and then rely on someone else to optimize it?
Why is there so many people surprised about the class keyword finally being implemented? I remember reading the reserved words for javascript way back in the 90's and seeing class in there. I always wondered how long it would take to be implemented. Here is a list of javascript reserved words.
HTML,JS,CSS,PHP,ect...
Right now web 2.0 is the Frankenstein of codeing.
-php to get dynamic data
-html to see the page
-css to make it look pritty
-javascript to alter a current page
So for me to update a section of a page without doing a complete reload need to... create a call in javascript that grab the html from a new page that is created by php, then we use javascript again to inject it into the html tag we want.
From the geeky side it seems cool... but for someone who develops web 2.0 pages, it would be nice if one standard framework would be developed that encompassed all these things. So that coding "Web 2.0" pages would be cleaner, easier, simpler, and more efficient.
Ah cool! Cross Site Scripting and site defacement 2.0!
Horns are really just a broken halo.
This looks like a weird combination of the "second system effect" (introduce a Java-like class system because supposedly that's what people want now), fixing what wasn't broken (introduce a Java-like class system to a language that didn't need it), not fixing what was broken (the strange constructor function/"this" semantics), and, inventively, breaking what wasn't broken (operator overloading). There's also a tiny bit of actual fixing what was broken (namespace system), but I don't think that that will save the day :-P
As an "old timer", I find it both fascinating and horrifying to watch the evolution of static web pages into "rich applications", shoehorned into the request/response model with a crazy wobbling mass of server-side languages, client-side language(s), browser plug-ins, HTML, DOM, CSS, JSON, XML... God knows what else. It's like GUI and client/server programming didn't exist before and they are trying to reinvent in the most illogical way possible.
Is it humanly possible to make this any more complicated, brittle, or insecure?
Don't answer that... I'm sure somebody's working on it.
I tried Silverlight, lots of features, bloaty and complex.
Flex is pretty clean, fast, and the language is great. Lots of pretty stuff, as well as lots of scope to create great platforms.
Screw Silverlight. Why muck around with unnecessary complexity and vendor locking. Flex is comparatively elegant and simple. Just my opinion for having used both.
Like all pain, suffering is a signal that something isn't right
Umm, This actually stuptifys Java,, Making it easier for people to use.. And in the process limits us real programmers.. Personally I would like to see it more customizable..
First, ignore the ad for the blog and go directly to the language specification.
I read through that and winced. It's one of those backwards compatible hacks that makes a language ugly. Current Javascript has a class implementation based on copying a base object, but no real class abstraction. This follows the model in Self. Most other object oriented languages (C++, Python, Java) have explicit class declarations. Javascript 2.0 adds class declarations without throwing out the old mechanism. This is a mess. I understand why they were forced to that decision, but it's still a mess.
The trend continues. They threw in most of the things Python 3K has and current Javascript doesn't: type annotations, generators, and packages, and namespaces. There's type checking, but it's optional for now. (This is like the transition from K&R C to ANSI C). Java-type interfaces where thrown in. At least they didn't add templates. It's a collection of features in search of a design.
In the end, we get something that's like a mixture of Java and Python.
Given the current state of standards adherence in modern web browsers, I think we can look forward to this being broadly implemented somewhere around third quarter of 2116.
Paul Anderson
"I drank WHAT?!" -- Socrates
... how IE will completely fuck everything up ruining everything for everyone that has to support that raging piece of crap.
Under WinXP, open the Task Manager to show CPU and memory consumption, minimize it, take Firefox 2.x to fark.com, open all the news article links in tabs, then close all of them (but leave the main page open.) Most of the time you'll not only have well over 100MB of RAM still in use, but you'll have your CPU smoking as well.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
This is all nice and well until someone misses the fact that a function which was expecting an array was expecting a specific kind of array. Something which has [] and size() and/or length() methods could be a regular old array in which elements are indexed by number and which iterates over elements in order of their numerical index. Or it could be an hash table which iterates over elements in an order appearing arbitrary from outside the implementation of the table. Then if the function expects a certain order of iteration, you're screwed.
At this point someone will interject "testing! testing!". Okay, but when using significant software written by third parties in python or Ruby or similar languages I've experienced several cases of exceptions being raised because one part of the software passed an unexpected object to another part. So I guess the testing did not catch that, now, did it?
I've written software used in a production environment (i.e. the business depended on the software working well) in both python and Java. So I'm used to both duck-typing and the strict kind of typing Java does. I don't think one is better than the other in any kind of absolute sense (i.e. irrespective of context). For scripting, I almost always use python. For bigger apps, it depends.
"If you dont know the difference between a group, a ring, and a field, you have no business overloading operators."
Hey! If it's good enough for mathmaticians then it's good enough for you guys.
JavaScript 2.0 is neat but M$ ain't gonna support it so it's basically dead in the water. Sucks butt...
This is JAVAAAAAAA! Sorry, can't resist
"I was uncool before uncool was cool!"
int, uint, long - now we can deal with currencies. I never understood the lack of explicit integer types in js. What was the idea behind that?
Also, the TFA link to the ECMA site is down and does not go to an authoritative document anyway. Try http://www.ecmascript.org/es4/spec/overview.pdf
How will this affect libraries such as Dojo? My first thought is that browser support will be even more complex and make libraries more necessary.
Verbum caro factum est
The sad part is all I wanted was -one- component from JS2: getters/setters. With that, you can go a long way in hiding the differences between browsers, by adding appropriate getters/setters.
FireFox supports getters/setters now, so does Safari, even the iPhone! But IE7? Haha.
(man pam_faildelay if you want to know how to set this). Why does this default to several seconds anyway? At a less annoying 100ms delay, it's still 345946 years to find a (uniformly picked) 8-letter, 62 chars password.
Medium cat is MEDIUM.
And: can VBScript be implemented on non-Microsoft platforms?
No script is bad because you dodge google ads.
Web2.0 sites make javascript *part* of the page content, so with noscript you cannot view the content.
Web2.0 powered by the mozilla hype engine.
slashdot is part of this. With javascript disabled and as an AC you have to click once to bring up the "old interface" and a second time to view the -1 comments of the fellow trolls. But the article is not visible in this mode. Go figure....
Javascript lacks interface inheritance, and that's what makes it weak.
Near as I can tell, the single-type/prototype nature of objects in the language sortof moots the need to define interfaces for the interpreter ahead of time. That leaves interface inheritance completely up to the programmer, which means that it's as weak as the programmer's ability to keep that straight.
Tweet, tweet.
In a surprising twist, Java applets are making a comeback: https://jdk6.dev.java.net/6uNea.html
Instant startup, improved stability and deployment. Deployment rates estimated at 85-90% of all clients.
I agree and I'd typedef that as well, but you missed the point.
I used a ridiculously complicated example in order to show that C's syntax is over-complicated. So over-complicated that long-time C programmers do not understand it.
I suggested a simple replacement which would be capable of simplifying it.
It simplifies very complicated examples by a lot, and simple examples by a little.
Parent is modded as funny, but should be modded as insightful. I'm a fan of akaimbatman, but for whatever reason, he and his ilk get off on putting others down over the most trivial of points - JavaScript's legitimacy (and the OP's familiarity with it) being one. No one is questioning JavaScript's place in the web world, or its Turing-completeness or what have you. But it is NOT on the same level as C++/C#/Ruby/Lisp/Whatever - and to state otherwise is fucking ridiculously naive and shows signs of insecurity in ones discipline.
JavaScript is inherently limited by its platform, development history and distribution model. It has no concept of threading, I/O, low-level memory management and garbage collection, sockets or graphics library. So those of us who do need these features get annoyed by those who dismiss them and place JavaScript on an equal plane with other development environments and platforms.
But that's not even my main issue with JavaScript. JavaScript's implementations across the browser board are usually incompatible with one another in fundamental ways (see fun topics like "multi-browser event bubbling", "XmlHttpRequest" and DOM-traversal and you'll find almost all solutions involve writing different blocks of code for different browsers.) That's not to say platform compatibility isn't an issue with other languages and environments, but these issues are front and center for any kind of large JavaScript "app".
I can't be bothered to rant about the other points, but I think I got my point across. JavaScript is what it is - and God bless it for that. But the snarky attitude akaimbatman took to the OP for not being familiar with JavaScript's intimacies is the exact attitude that tends to draw the eye-rolling from other developers on different platforms.
Clearly Javascript works well for some people, and less well for others. All depends on your experience and background. What I'd really like to have is a choice of language. If, instead of interpreting scripts, browsers standardised on a bytecode, we could write in whatever language had a suitable bytecode compiler. It's sort of possible now, with compilers like PyPy and HaXe being able to output Javascript, but that's still a hack with unnecessary overhead and makes debugging more difficult. This isn't the same as having a Java VM in the browser, of course -- AFAIK, there's no standard way for Java applets to access the DOM, and it's more heavyweight anyway.