4 ms·
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-eng
by program 15y ago
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.
- heisenmink 15y agoI just press shift+´ to get `
- deleted 15y ago[deleted]
- benjoffe 15y agoWhat other character would you suggest? At least multi line strings arent super common (nor essential) so extra difficulty isn't a major problem.
- masklinn 15y ago> What other character would you suggest? Fixing the language so newlines in strings are legal, Python-style triple quoting or some sort of string modifier prefix (similar to Python's rawstring modifier)
- program 15y agoI 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";
- dbattaglia 15y agoThe only thing about the C syntax version is you still end up with a bunch of double quotes all over the place. The #1 reason I have for using multi-line strings currently is when writing full-out SQL or Javascript code inside C#; using C#'s @-prefixed strings make the whole thing a lot prettier to look at IMO. For me personally I'll probably never have to write multi-line JS strings more than once a year so I don't really care about the feature, but I do agree with their way of implementing them.
- demallien 15y agoFriends don't let friends use layouts other than QWERTY (glares at the AZERTY keyboard her employer gave her that was rapidly replaced with a QWERTY from home).