3 ms·
It seems to me that callbacks are a solution to a problem that green threads (Erlang, Go, Stackless Python) solve far simpler. A system of call backs with event
by fmstephe 15y ago
It seems to me that callbacks are a solution to a problem that green threads (Erlang, Go, Stackless Python) solve far simpler. A system of call backs with events mixing multiple logical processes into one thread of control seems very complex.
(Question: How do other people debug callbacks? If our state sits in a single thread with hundreds (thousands?) of functions waiting in the wings - how do we tease out the state and control flow of a single request?)
My experience with callbacks is all in Javascript. It can be a fun model, but the author's description of his own mental model for callback code illustrates the complexity of this approach.
Time will tell how this pans out. Will we be using callbacks in 5 years time, probably - Javascript isn't going away any time soon. Perhaps given that javascript will be the way more and more people start programming the callback mental model will be strong for years to come. I hope not, this may mean I will have to develop my own internal landscape to reason about all those callbacks. :)