JavaScript Creator Talks About the Future
mikejuk writes "JavaScript is currently an important language — possibly the most important of all the languages at this point in time. So an impromptu talk at JSConf given by the creator of JavaScript, Brendan Eich, is not something to ignore. He seems to be a worried about the way committees define languages and wants ordinary JavaScript programmers to get involved."
Not so sure I'd agree with that summary - I don't doubt the importance of JavaScript to the modern internet but I'd be more inclined to consider the C's of this world as the main foundation of the industry.
jaymz
Just wait until you've had to fix your first Node.js and MongoDB disaster. I'm working with one client to get rid of such a system. It is by far one of the worst gigs I've ever had, and I've had to clean up a whole lot of stupid shit before.
JavaScript barely works as a client-side scripting language, and even then the experience is totally shitty for developers and users alike. Slashdot is a really good example of how JavaScript can absolutely fuck up a site unnecessarily.
But it has absolutely no place for server-side development. It's just not up to the task in any way. It's missing basic language features necessary for large-scale server-side development. Its development tools are atrocious. Its runtime performance is horrible. Node.js is fucking stupid, and that's putting it nicely. Using it to query a data store is an extremely idiotic idea. All in all, it's a massive failure.
JavaScript "programmers" have put together some of the worst and most broken systems that I've ever dealt with, and I've been dealing with horrible systems written using languages like PHP, Visual Basic, PowerBuilder and Perl. JavaScript may be one of the biggest computing disasters of all time.
... how do you really feel?
"Consensus" in science is _always_ a political construct.
Javascript doesn't have types to speak of
str = "10" + 2; - becomes "102"
num = 10 + 2; - becomes 12
num = 10 + 2 + "2"; - becomes 14
num = "10" - 3; - becomes 7
num = 10 / "2"; - becomes 5
num = "2" * 4; - becomes 8
num = 35.00;
str = "VALUE IS: " + num; - this becomes "VALUE IS 35".
--
Sure, it's a bit strange, but nothing extraordinary.
---
No scope to speak of
well, it's not true really. In the following example x will have global scope and y will be local to its function:
x=2;
function test() {
y = x + 3;
}
--
no real notion of classes
function Person(name, gender) {
this.gender = gender;
this.language;
this.name;
this.toString = function() {
return '' + this.gender + ' ' + language;
};
}
Person.prototype.getName = function() {
return this.name;
};
var person = new Person('Bob', 'male'); ...
person.language = 'English';
person.gender - this is 'male'
person.language - this is 'English'.
person.toString() - this is 'male English'.
person.getName() - this is 'Bob'.
--
Of-course you can also just evaluate a string into a class on the fly, few language allow that:
eval('
var person = {
name: "Bob",
gender: "male",
toString: function () {
return this.name + " " + this.gender;;
}
}
');
person.name - this is 'Bob'
person.gender - this is 'male'.
person.toString() - this is 'Bob male'.
No inheritance
- well, there is the keyword "inherits" and it does allow an object to be extended and you can use the 'prototype' to have multiple inheritance.
--
I am not saying this language is wonderful, whatever, but saying it is lacking various features, that it clearly has, even though they look different from other languages... it's disingenuous.
As to the question whether this language has anything that others do not, again, how about on the fly reflection via evaluation of strings into objects? When I first saw that over a decade ago, I thought it was a neat concept then, I still think it's a neat concept today.
You can't handle the truth.
""+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading."
function foo(x,y) { return x + y; }
foo("5",6) == "56"
In every other language I've seen, the CORRECTly expected result is 11 or error. Perl, C++, etc. The point is that you can never trust your input if you are expecting numeric.
You must guard the inputs with explicit (and thus inefficient/unreadable casts). If you're using a 3rd party library, you'll be pulling you hair out trying to figure out what went wrong.
The language is full of such wtf's. While you can happily redefine most core operations (e.g. how jQuery fixes IE), you can't overload the + operator. Call my cynical, but I don't like languages that let you corrupt basic building blocks.
That being said, javascript is excellent at what it was designed for - and passable for what it's currently used for, but I fear for the future if it's the basis of future industrial strength applications.
One place I WOULD like to see it extended is DB's.. CouchDB has a very nice java-script based map-reduce framework - it leads to concise and expressive code (that's really NASTY if plsql, etc are used).
Basically javascript is excellent fragment-code. But HORRIBLE for modular libraries - having to write an entire library (like jquery) in a scoped wrapper then assigned to a mutable/corruptable symbol is sick. (Especially since library A will mutate library B without permission - hello 1970s!!)
-Michael
JavaScript isn't even that important to the modern Internet. It's pretty isolated to the Web,
Yup, and the web isn't very important to the modern Internet at all.
and even there it's only seriously used by a small number of sites.
Just a few tiny, insignificant ones like Slashdot, Google (Docs/Maps/GMail) and any other website that contains anything more interactive than a form submit button. Except the ones that use Flash (but then the ActionScript language used by Flash developers is a superset of ECMAScript.) - or Java, which really is "only used seriously by a small number of sites" (for given values of "small" and "seriously").
Its also the only game in town if you want to target iOS, Android and desktop browsers with the same codebase. Meanwhile, Java's star seems to be falling, .Net/C#/VB (however well respected) are effectively Microsoft-only.
For every line of JavaScript in a given web site, there will be hundreds, if not thousands, of lines of C or C++ code doing the real work within the JavaScript interpreter
Well, yes, that will be true of any "scripting" language.
The statement in TFA that Javascript is "possibly the most important of all the languages" is flamebait, but your position is equally absurd.
The "contest" is probably Javascript vs. Python/Ruby/Perl/PHP. ("CoffeeScript", mentioned in TFA seems to be an effort to make JavaScript look more like the first three of those to appease the haters of curly brackets - where's the campaign to make Javascript look more like PHP, I ask !? :-) ).
In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.