In C # it is usually written fairly objectively, for example:
MyObj obj = new MyObj(); MyReturn ret = obj.DoSomething(); AnotherReturn rett = ret.DoSomethingElse();
I could just write above:
AnotherReturn rett = new MyObj().DoSomething().DoSomethingElse();
However, how does the stack frame work when you have a bunch of function calls in that order? The example is pretty simple, but imagine if I have 50+ function calls (this can happen with JavaScript like this (/ w jQuery)).
My assumption was that for each function call, a return address is performed (to the "point"?), And the return value (a new object with other methods) is immediately pumped into the next function call while returning the address. How does it work wrt getting a common return value (in this example, the return address will assign the final value to the rett function)? If I continued the chain of calls, would I, in the end, overflow? In this case, is it wiser to use an objective route (due to the "unnecessary" memory allocation?).
source share