News for hackers. Stuff that matters.
Re:ES6: The features I'm most excited about by dpweb on Sunday July 05, 2015 @08:56PM (#9835971)
Promises I find rather ugly to read. So far Im liking arrow functions and template strings. Async/await I'm looking forward to in ES7.
Re:ES6: The features I'm most excited about by savanaly on Sunday July 05, 2015 @09:16PM (#9836039)
What exactly did you have in mind other than "new Promise()" to create a promise?
Re:ES6: The features I'm most excited about by iamstef on Sunday July 05, 2015 @09:29PM (#9836090)
its not creating a promise that is the problem, its consuming.

Async/await really is a nice sugar, check it out when you have a chance.

Re:ES6: The features I'm most excited about by striking on Sunday July 05, 2015 @09:45PM (#9836155)
new Promise(function(resolve, reject){ /* code */ })

it's a little much

Re:ES6: The features I'm most excited about by inglor on Sunday July 05, 2015 @11:36PM (#9836603)
That's because 99% of times when people use it it's an anti pattern: stackoverflow.com/questions/23803743/what-is-the-explicit-promise-construction-antipattern-and-how-do-i-avoid-it
Re:ES6: The features I'm most excited about by tlarkworthy on Sunday July 05, 2015 @10:24PM (#9836326)
Ideally, if you're writing business logic, you shouldn't be creating promises but consuming/combining/chaining them from libraries.
Re:ES6: The features I'm most excited about by taternuts on Sunday July 05, 2015 @11:10PM (#9836517)
What would make you say that? Why wouldn't you use promises in your business logic?
Re:ES6: The features I'm most excited about by DCoder on Monday July 06, 2015 @01:38AM (#9837003)
The idea isn't "don't use promises", it's more "use/chain the promises you already got from libraries (e.g. AJAX calls), don't construct new promises yourself". See the StackOverflow question inglor linked to: https://stackoverflow.com/questions/23803743/what-is-the-exp...
Re:ES6: The features I'm most excited about by tlarkworthy on Monday July 06, 2015 @11:12AM (#9839646)
Yeah what dcoder said. You only need to create a promise at the source of an async event like IO. Internal logic will be downstream of IO and therefore will be just be sequencing promises generated elsewhere. You do not (and should not) need to create intermediate promises to do that.
Re:ES6: The features I'm most excited about by Wintamute on Monday July 06, 2015 @05:13AM (#9837776)
Most of the time the object you'll be awaiting will be a promise.