Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

ES6 Promises Instead of Deprecation Warning #54

Open
ddwwcruz opened this issue Sep 14, 2017 · 6 comments
Open

ES6 Promises Instead of Deprecation Warning #54

ddwwcruz opened this issue Sep 14, 2017 · 6 comments
Labels

Comments

@ddwwcruz
Copy link

Currently, when using asynchronous functions without callbacks the system gives a deprecation warning. Can it return a promise instead? That way it can be used in an async/await style.

Based on what I know this couldn't be done in Node because of all user's legacy codes.

@hypesystem
Copy link

If all that is blocking is user legacy code, it could potentially be shipped behind a flag (--promises-on-missing-callbacks). That would let us decide on whether to make it default behavior, depending on how many people still use the deprecated versions at some later point in the future.

I am a big fan of the idea, but I don't know how much the deprecated calls are in use, and how many libraries we would potentially break.

@Fishrock123
Copy link
Contributor

Could you please describe in more detail how this would work / what you are looking for?

@addaleax
Copy link
Contributor

@Fishrock123 I think this is about making fs.stat(filename) & friends return promises when no callback is passed

@ddwwcruz
Copy link
Author

@Fishrock123 what @addaleax just described

@jkrems
Copy link
Contributor

jkrems commented Sep 15, 2017

This sounds like a pretty neat feature. Would be interesting to see how many things it would break but given that the old behavior is already deprecated..?

I definitely wrote multiple promisify in each source file I created today so it sounds like a great quality of life improvement to me. It might be a challenge to do it in a way that doesn't affect performance to badly. Maybe it would actually be easier to have a "promisified" interface of core shipping as separate entry points, either module- or function-wise? That would skip all callback checks immediately.

@Fishrock123
Copy link
Contributor

This is more-or-less requesting a port of nodejs/node#5020, which didn't land in Node at the time.

This sounds like a pretty neat feature. Would be interesting to see how many things it would break but given that the old behavior is already deprecated..?

None. The deprecation is not about the same thing.

@addaleax could you please update the title to reflect the request better?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants