News for hackers. Stuff that matters.
Re:ES6: The features I'm most excited about by zhodge on Sunday July 05, 2015 @09:55PM (#9836189)
Hm, at first glance I am as well, especially with tagged template strings. Those look particularly simple but powerful.

Generally though, is it reasonable for features such as these to be included at the language level? I primarily use ES5 JavaScript so I'm used to pulling in a decent amount of modules (in this case handlebars, underscore, etc.) for things like templating.

But I will be relieved to have a language-standard solution to what feels like such a common problem for the environments in which JS is used primarily, despite the tradeoff that's made in accessibility due to feature bloat.

Re:ES6: The features I'm most excited about by abecedarius on Sunday July 05, 2015 @10:59PM (#9836473)
Yes, for at least two reasons:

Unsafe string-munging is too easy and seductive. Doing things the safe/secure way needs to be at least as easy.

And it makes for a growable language, the way Lisp macros do. E.g. https://github.com/erights/quasiParserGenerator This can reduce the demand for feature bloat in future language standards.

Re:ES6: The features I'm most excited about by madeofpalk on Sunday July 05, 2015 @10:33PM (#9836363)
> for things like templating.

I'm excited for not having external libraries to handle string interpolation.

Re:ES6: The features I'm most excited about by Pephers on Monday July 06, 2015 @04:46AM (#9837684)
I too was reluctant of using many of the new ES6 features, but as I've begun to adapt them I've come to appreciate them a lot! In fact, when using Babel to compile ES2015/2016 you can in many cases rid yourself of things like Underscore/lodash[1], Promise libraries, etc.

I've recently started a new project in React/Flux, and I've cut away 3 or 4 dependencies compared to previous projects by fully embracing ES2015/2016, as Babel automatically provides the necessary polyfills and compilation.

As for template strings, I think they make sense. Most programming languages have them in someway or another, like Ruby "hello #{world}" or Python 'Hello {world}'.format(world='World').

[1] https://www.reindex.io/blog/you-might-not-need-underscore/

Re:ES6: The features I'm most excited about by jdd on Tuesday July 07, 2015 @01:50PM (#9846962)
lodash has ~200 modular methods. That means it covers much more ground than the handful of ES5/6 built-ins provided and because it's modular you can use what you need without the stuff you don't.
Re:ES6: The features I'm most excited about by mattmanser on Monday July 06, 2015 @04:34AM (#9837631)
Most modern languages already have this feature, JavaScript's the strange one to not have a quick way of putting variables into a string and the first to have to name it though because it was missing it for so long. And by your comment have evidentally chosen a confusing name. This isn't to replace templating engines.

Admittedly you could trivially extend the string prototype to have something more akin to string.format or printf, which was something you couldn't do in other languages for a long time, making it less of a problem.

Re:ES6: The features I'm most excited about by rnnr on Monday July 06, 2015 @10:10AM (#9839169)
And still you cant 'lazily' store string vars without evaluating.

In python you can save a string like: template = '%s is %s' and _then_ evaluate its output: print template % ('john', 'tall')