What is Rückruf Hoelle in Node js

What is "recall hell" and how and why does RX resolve it?

1) What is "callback hell" for someone who doesn't know Javascript and node.js?

This other question has some examples of JavaScript callback hell: Avoiding long nesting of asynchronous functions in Node.js

The problem in Javascript is that the only way to "freeze" a computation and do the "rest of it" (asynchronously) is to put "the rest of it" in a callback.

Suppose I want to run the following code:

Now what if I want to make the getData functions asynchronous, which means that I have the option to run some other code while waiting for them to return their values? In Javascript, the only way to rewrite anything that touches an asynchronous computation using a continuation passing style:

I don't think I have to convince anyone that this version is uglier than the previous one. :-)

2) When (in which settings) does the "recall hell problem" occur?

When you have a lot of callback functions in your code! They get harder to work with the more of them you have in your code, and it gets especially bad when you have to do loops, try-catch blocks, and the like.

For example, in JavaScript, as far as I know, the only way to perform a series of asynchronous functions, where one is executed after the previous returns, is to use a recursive function. You cannot use a for loop.

Instead, we may need to write at the end:

The number of questions we get here at StackOverflow is proof of how confusing it is :)

3) Why does it occur?

This is because, in JavaScript, the only way to delay a calculation that is performed after the asynchronous call return is to put the delayed code in a callback function. You can't delay code written the traditional synchronous style, leaving you with nested callbacks everywhere.

4) Or can "callback hell" also occur in a single threaded application?

Asynchronous programming has to do with parallelism, while a single thread has to do with parallelism. The two concepts are actually not the same.

You can still have concurrent code in a single thread context. In fact, JavaScript, the queen of callback hell, is single-threaded.

What is the difference between parallelism and parallelism?

5) Could you please also show how RX solves the "recall hell problem" with this simple example?

I don't know anything specific about RX, but usually this problem is solved by adding native support for asynchronous computation in the programming language. Implementations can vary and include: Async, Generators, Coroutines, and Callcc.

In Python, we can implement the previous loop example with something that looks like this:

This is not the complete code, but the idea is that "yield" will hold our for loop until someone calls myGen.next (). The most important thing is that we can still write the code using a for loop without having to reverse the logic like we had to do in this recursive function.