4 ms·
>> More seriously, ask the question: what relationship between multiple values is useful for returning from functions but not useful enough to be a data structu
by CraigJPerry 13y ago
>> More seriously, ask the question: what relationship between multiple values is useful for returning from functions but not useful enough to be a data structure that can be used in other parts of code?
Any metadata about that particular function call.
E.g. function success / effectiveness (did state change?). Runtime. Memory usage.
EDIT: I think co-dependants are still the primary use case, im just suggesting another less obvious use case.
- asolove 13y agoWhy not have these on data? If they only get returned from one function call, you have to manually deal with them in each function. If attached to data, they can get aggregated over large chains of fn calls.
- CraigJPerry 13y agoWhy pollute your data objects when you could just return a separate object at the same time? Improves cohesion. Seperates responsibilities. Removes duplication and redundancy. When you pass the metadata off for aggregation or other processing with this multi return model, you dont pull along a chunk of irrelevant business data at the time.