The Future of JavaScript
blog.chromium.org
The Future of JavaScript
1–10 of 115 posts
Re: The Future of JavaScript
#2Re: The Future of JavaScript
#3 > No surprises, no more need to abuse objects as dictionaries.
... pretty much every single file of JS ever written is "guilty" of this.Re: The Future of JavaScript
#4Firefox nightlies have all of these features as well. Good to see Chrome following suit.
[1]: https://developer.mozilla.org/en/JavaScript/Reference/Global...
Re: The Future of JavaScript
#5> No surprises, no more need to abuse objects as dictionaries. ... pretty much every single file of JS ever written is "guilty" of this.
If that was an abuse, what are JavaScript objects supposed to be? What's the difference between them and a dictionary?
Re: The Future of JavaScript
#6> No surprises, no more need to abuse objects as dictionaries. ... pretty much every single file of JS ever written is "guilty" of this.
I've only delved into really writing JS for the last couple of weeks, but a number of tutorials basically said that objects are dictionaries and vice versa, you just got some nice syntax and you can plug function in as values. If that was an abuse, what are JavaScript objects supposed to be? What's the difference between them and a dictionary?
var dict = {};
dict["hasOwnProperty"] = true;
dict["toString"] = "Bob";
dict["valueOf"] = 7;
... then you're in for a rough time.Re: The Future of JavaScript
#7Earlier quoted context omitted.
I've only delved into really writing JS for the last couple of weeks, but a number of tutorials basically said that objects are dictionaries and vice versa, you just got some nice syntax and you can plug function in as values. If that was an abuse, what are JavaScript objects supposed to be? What's the difference between them and a dictionary?
It's only an abuse because JavaScript has no distinction between the notion of an object's "meta" properties, and its dictionary-like keys and values. So you'll get along just fine, until someone tries to write this: var dict = {}; dict["hasOwnProperty"] = true; dict["toString"] = "Bob"; dict["valueOf"] = 7; ... then you're in for a rough time.
Maps/Set/WeakMap properly support arbitrary objects as keys.
Re: The Future of JavaScript
#8Would be really unfortunate to have to wait for a native OrderedMap/SortedMap/TreeMap until ES7.
Re: The Future of JavaScript
#9Earlier quoted context omitted.
I've only delved into really writing JS for the last couple of weeks, but a number of tutorials basically said that objects are dictionaries and vice versa, you just got some nice syntax and you can plug function in as values. If that was an abuse, what are JavaScript objects supposed to be? What's the difference between them and a dictionary?
It's only an abuse because JavaScript has no distinction between the notion of an object's "meta" properties, and its dictionary-like keys and values. So you'll get along just fine, until someone tries to write this: var dict = {}; dict["hasOwnProperty"] = true; dict["toString"] = "Bob"; dict["valueOf"] = 7; ... then you're in for a rough time.
..will not have any of those properties. Works only in v8 though, AFAIK.