4 ms·
> As someone old I still prefer callbacks That's perfectly fair but you may be in a bubble if you really believe your preference reflects the general tendency
by lucideer 3y ago
> As someone old I still prefer callbacks
That's perfectly fair but you may be in a bubble if you really believe your preference reflects the general tendency of the community.
Yes, a lot of Node's API is still reliant upon callbacks, but newer APIs where promise support has been added are generally preferred, and outside of those, most people rely on library abstractions anyway - most of which wrap Node's internal APIs in promises. Bluebird was around since 2013 & was very popular with the NodeJS community.
> it’s just functions
So are promises really. There's very little effective syntactic difference between `const x = new Promise((func, func) => {});` and a function accepting callback(s) - the main differentiator is a separate error callback instead of the error-first argument convention. Yes the internals are different to allow assignment & chaining without nesting but nesting is still just as possible if preferred.
But yeah if you prefer callbacks go ahead. Just make sure the team you're collaborating with is reasonably aligned on preference.
- austin-cheney 3y agoare generally preferred Who cares? Why are you trying to tell me what my opinion on code preference is? https://owl.excelsior.edu/argument-and-critical-thinking/logical-fallacies/logical-fallacies-bandwagon/ https://owl.excelsior.edu/argument-and-critical-thinking/log... So are promises really Absolutely not. Promises are a separate convention of chained .then methods.
- lucideer 3y ago> Who cares? You seemed to as you commented to that effect. > Why are you trying to tell me what my opinion on code preference is? Did I?
- nonethewiser 3y ago> are generally preferred > Who cares? You said “Not really” in response to the claim that “Currently, promises are the de-facto way of handling asynchronous tasks in Javascript.” So I guess you care.
- austin-cheney 3y agoReading comprehension helps. I said that promises are not really defacto standards. They are a standard convention of the language and one of three ways of handling asynchronous actions.
- nottorp 3y agoSo a promise is a fancy name for a callback? Bar syntactic sugar.