Andrea Giammarchi schrieb:

simply adding
async and await and the only change to do in a well known/used
*synchronous* API would be to check if the returned value is held and
behave accordingly?

No, making a consumer of an API asynchronous should not be simple. Unless you are only writing pure functions, everything that involves states will very likely break. Concurrency is not trivial, it needs a lot of consideration.

as soon as you go for
async/await or a generator that function will return a Promise for you.

Please never do that. Functions that sometimes return promises and sometimes not are already known to be an antipattern. Making this obscurely dependent on some fragile syntactic conditions could only make this worse.

If you want to migrate your library to asynchrony, just make it a breaking change. Your consumers will thank you for it.

Kind regards,
 Bergi
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to