JavaScript Creator Talks About the Future 305
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."
Re:I have a suggestion. (Score:4, Informative)
Re:Javascript is a disaster (Score:5, Informative)
It looks object oriented, but has no real notion of classes. No inheritance.
I agree with most of your points, but not this one. Class based and object oriented are orthogonal. Simula was class based, but not object oriented. JavaScript and Self are object oriented, but not class based. And JavaScript does have inheritance, a reduced form of the same differential inheritance that Self has (only one parent, can only be assigned at construction time). New objects inherit from the object in the prototype field of the constructor object.
Re:Javascript is a disaster (Score:5, Informative)
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.