|
|
|
|
|
by Swizec
4859 days ago
|
|
> but, unlike other dynamic (and many static) objects in most languages, do not offer any interfaces to manipulate and reason about them Sure they do. You just need to start thinking of javascript as a functional language and all this stuff becomes much ... simpler. First of all, why would you even need to reason about a function's internal state? That's a sign of a leaky abstraction. Furthermore, every time you want to manipulate the internal state of a function, what you're really after is defining a better API to provide arguments to said function. And if you still for some reason need to dick around with a function's internal state, just use partial function application. |
|
If all you have to implement async operations are plain callbacks then yeah, they are not really an abstraction of anything, and you can probably call them 'leaky'. Which is why you need to create real abstractions around them, like promises.
I think we basically agree.