-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeUp: A Callback Convention Show #40
Comments
This issue has been discussed in a previous nodeup. Convention unanimously error first, and once async always async (don't release zalgo). |
AFAIK |
That agreement is fine but it doesn't address the more strict questions that @CrabDude has posited. |
@FredKSchott I'm down |
Sounds good to me. |
Me too :) |
As an anecdote, I just added an adapter to asynquence that allows you create wrappers around several (six, in fact) variations of function signature around callbacks (params-first vs params-last, errfcb vs splitcb vs simplecb) -- see the six config options. It's a shame this sort of complexity is necessary, and were we to have a stronger contract convention (not just in node, but beyond) for such things, we would reduce the cognitive load AND the complexity of libs across the board. |
This is a nice topic but could it span an entire show? Can someone outline 3 broad sections they would take 40mins to an hour or is this more like a quick 20min show? |
@rvagg yea it had been a bit more of a topic at the time that this was posted, @CrabDude had just posted that gist and there had been some discussion on Twitter. I haven't heard the topic mentioned much since. I doubt this would ever be a controversial topic, the format would probably be more educational / exploratory in nature (check the OP). I still think the discussion would be interesting, but given how much else is going on and how busy it has been lately, I haven't looked into it any more than the original post. |
@rvagg Yes, this topic is controversial. Presently, I do an hour+ session on it in my Noderiety trainings in my weekly engagements. You could easily do 3 hour-long sessions on this. Here's a rough outline:
FWIW, I have a 5 year history of strong public Promise opposition, so my pro-Promise stance is reluctant and therefore objective. Additionally, my wisdom regarding the above is largely gained from my experience with my async trycatch library that solves an issue that is otherwise presently completely broken and unaddressed in the community (think what domains should have been and what event source hooks won't solve). I'm happy to sit down or Skype ahead of time on the above if you would like more details. |
You can pretty much add the whole second half of this talk as a major contention point for asynchrony in node, "Netflix JavaScript Talks - Version 7: The Evolution of JavaScript" TLDR; ES6/7 language features (Promises, async/await, Generators, Iterables, and Observables) are likely going to obviate callbacks and node.js Streams, in a good way, especially by making streams even more composable: for(let data of readFileStream) {
// ...
} |
Promises don't obviate callbacks, they simply let you pass callbacks to a different, more composable, more trustable mechanism. Generators(+promises) just hide where the callbacks are specified, async/await puts syntactic sugar on top of generators+promises, and observables even further abstract async functions into generators to allow multiple outputs. No matter how much abstraction you layer on top, when you unravel the whole stack, it still comes back to callbacks. |
The risk for this show is it simply devolves into an argument about Promises and ES6 and ES7 features and whether they are the magic that will save the world or the spawn of the hell. It's kind of difficult to have a balanced and calm and objective discussion about these things without it being completely lop-sided, and we're certainly not after a single-person rant either. Note how quickly we've shifted from a "callback convention show" to something entirely different, that's the nature of this topic area, almost without fail. Perhaps @timoxley would be interested in taking this one on and crafting something interesting out of it? Also of interest here is the last io.js TC meeting discussion on crafting a statement on the adoption of a Promises API, see 2/3rds of the way through the video: https://github.com/iojs/io.js/pull/144/files |
I'll respond more fully later, but I did want to mention that the devolution of the argument is in fact an indication that there is something good and of value beneath the surface, we just need to extract it and avoid the noise, and flames. Also, my last comment was because the recent Netflix talk really drove home to me how objectively superior from a language integration and composability perspective promises/async/await will be to other means. I'm not trying to flame; I'm being earnest and encourage you to watch the talk and ask yourself:
I'll come back with a more focused response and revised proposal when I have a little more time. |
Yes. You are completely right. Any discussion would need to be focused and not just conjecture or opinion. If there's interest, I propose the following outlines for 2 separate discussions: ####Callback Contracts (no promises)
####Promises, async, await, observables
As an aside, from the io.js meeting minutes,
Since I have no direct influence on core, my opinion and perspective is primarily as an application developer and trainer. In that regard, I think first-class promises/async/await/obervables integration will be adopted rapidly and are far easier to teach and become part of an "Async JavaScript: The Good Parts" type of rubric. I don't know where or if that opinion fits into nodeup in any way though. |
Sounds like a good show to me. I'd be happy to run that, I'm not emotionally invested in either camp. @jonathanong would be good fuel for the fire. Should probably pull in a TC member, maybe @bnoordhuis. |
don't feel like bikeshedding on control flow in public... my only opinions are primarily:
that's all i'd say really. |
@jonathanong that is great content. Even if you just read this aloud I think it's worth getting you on board. I'd also like to discuss things like the recent changes in co (thunks -> promises) and also your work on mz. |
I want to politely decline, I'm not really cut out for interviews or debates. |
@getify, @CrabDude, and myself have all taken stabs at this, but there still isn't an agreed upon callback contract within the community. Conversations around the topic are usually enthusiastic, but twitter and 140 characters does not a good forum make.
NodeUp could be an interesting place to have this conversation with & in front of the community. Not necessarily to come to an agreement, but to discuss the finer points of what would belong in a contract / what a contract might look like if one existed.
Not sure if NodeUp has ever taken on a topic like this or a show in this format, but the possibilities sounded interesting :)
Relevant Links:
The text was updated successfully, but these errors were encountered: