Live data from Hacker News

ECMAScript 6 looks promising

kishorelive.com

71–80 of 94 posts

Re: ECMAScript 6 looks promising

#71
post #46

Using the ` (backquote) character for multiline strings isn't a wise choice (probably inherited from Go) cause it's difficult to reach that character on non-english keyboard layout. In the italian layout it's alt+\ or alt+9 on the Mac but you can't reach it using Windows; you need to press alt+96.

[deleted]

Re: ECMAScript 6 looks promising

#72
post #49

But, how are we going to migrate? Compile down to the current version and serve two files? I feel like this migration process will take way too long.

For some web apps it will probably take long. But with all the developments in browser land there is often more then one reason to develop against the latest anyway. Hopefully this will motivate corporate IT to move faster also.

That's one good thing about using a feature like WebGL :)

By forcing my users to use the latest versions of Firefox and Chrome I get access to a lot of nice new functionality.

Re: ECMAScript 6 looks promising

#74
post #46

Using the ` (backquote) character for multiline strings isn't a wise choice (probably inherited from Go) cause it's difficult to reach that character on non-english keyboard layout. In the italian layout it's alt+\ or alt+9 on the Mac but you can't reach it using Windows; you need to press alt+96.

What other character would you suggest? At least multi line strings arent super common (nor essential) so extra difficulty isn't a major problem.

Re: ECMAScript 6 looks promising

#75
post #46

Using the ` (backquote) character for multiline strings isn't a wise choice (probably inherited from Go) cause it's difficult to reach that character on non-english keyboard layout. In the italian layout it's alt+\ or alt+9 on the Mac but you can't reach it using Windows; you need to press alt+96.

What other character would you suggest? At least multi line strings arent super common (nor essential) so extra difficulty isn't a major problem.

I don't think that there is the need for a new character. The problem here is that JS has automatic semicolon insertion. This:

  var a = "abc
   def";
generate a "unterminated string literal" syntax error cause a semicolon is inserted after abc. Why not using C/C++/ObjC syntax?

  var a = "a very "
   "very long string";

Re: ECMAScript 6 looks promising

#76

Earlier quoted context omitted.

That's the idea. Python uses the same syntax for multi-line strings as for comments.

> Python uses the same syntax for multi-line strings as for comments. No it does not. Triple-quoted strings are still strings, all comments in Python are prefixed with `#`. There are two situations where triple quoted strings are used as "comments": * Multiline comments for lazy people, as Python has no multiline comment syntax * doc strings . As the name indicate, they're strings , they're not comments and should no…

Damn, I just got comfortable with functions being first class constructs, now I have to get used to the idea of comment meta-programming.

Re: ECMAScript 6 looks promising

#77
post #9

Earlier quoted context omitted.

I don't know much about PHP, what's wrong with it regarding templating?

Automatic interpolation of variables into string literals is a bad idea IMHO. Couple that with variable hoisting (function scope) and hilarity can ensue when variables defined further down a function influence the value of another variable that looks like it just contains a string literal.

Strings with interpolation look different in ES6. They don't just look like string literals. You can easily see where the variable substitutions happen.

Also, I don't know what your argument about PHP is all about. I don't agree with the idea that string interpolation is going to lead to people writing code vulnerable to SQL injection, for example. You can just as easily write "select * from foo where name=\"" + name + "\"" as `select * from foo where name="${name}"`.

Re: ECMAScript 6 looks promising

#79
post #51

`let` is good but please, give me `let ... in` too: let callback = function(a, b) { // ... } in object.registerCallback(callback);

I don't know what they've selected for ECMAScript 6, but the `let` keyword as introduced in Firefox 2 has 3 different forms: * Let definitions are equivalent to `var` but block-scoped, so if (x > y) { let gamma = 12.7 + y; i = gamma * x; } `gamma` is local to the `if` block and will not leak out. This form can be used to create bindings in `for` as well: for ( let i=0 ; i * Let statement, mostly for side-effects, suf…

Let statement, mostly for side-effects, sufficient for what you need:

Sadly it's not. JS has some semantic foibles, but I find myself up against syntax more often than I'd like. Every time I write it I'm impressed at how ugly the syntax is vs for such a good language (modulo the standard library.)

The very thing I'm trying to avoid is the use of blocks within parentheses. (Aside: I changed my font to Monaco for JS because of the frequent appearance of `})`, and went to the trouble of fixing it up in Fontforge so gvim et al. would be willing to use it.)

I never want to see this:

    anything(block {
        // ...
    }) 
but I still want the definition to be short-lived (more for self-documenting purposes than anything else, now that I think of it.) Your last example almost has it, but the parens are right there where I want them gone.

Re: ECMAScript 6 looks promising

#80
post #63

64-bit integers and bitwise operations together with default arguments and destructuring would solve just about everything.

I cannot rightly comprehend what problems one must be having if the solution is a wider bit width and variable assignment sugar.
Post reply on HN