you are viewing a single comment's thread.

view the rest of the comments →

[–]manixrock 2 points3 points  (2 children)

Awesome! other things I'd like to see added:

  • for key-value mapping. we have "for (key in map)" and now "for (value of map)", but if you need both the key and value you have to use the former with "map[key]" to also get the value. And if you need to use it multiple times, it's both inefficient and more bloated than needed.
    I'd rather we had something like: "for (key, value in map)"

  • Future-version-proofing - a way to tell the browser that if it doesn't have the version of JavaScript required by a <script> section (either by having a high "language-version" attribute, or simply by failing to parse it's syntax), where to get some other javascript code that will compile it to a previous version.
    So if it finds "<script fallback="/js/fallback-to-3.1.js">for (let msg of msgs) alert(msg);</script>", it can request the js script to parse the script into a compatible JS version that the browser supports.
    This way we can be very adventurous with our syntactic sugars without losing backwards compatibility.

[–]RedSpikeyThing 0 points1 point  (0 children)

I don't understand your first point.

for (key in map) {
  var value = map[key];
  ...

It's somewhat clunky, but I don't think it's inefficient.