in reply to Any framework for bulk operations?
There is no way to predict how many (or which) other objects you will be calling ->op2() on, when you call report_row() on the first of them. Or the last for that matter.
However, if you wrap up your collection (array) of objects in a class, then you can provide a ->report_rows() method that knows how many (and which) objects you intend to process and so it can aggregate the individual steps if that makes sense. Of course, when I say "it can aggregate", that really means "you can aggregate" when you write that method. (Of course, you could write report_rows() as a function equally well.)
There isn't, and probably could not be, any mechanism that could analyse your report_row() function and automatically generate a report_rows() function from it.
|
|---|