
14 Apr
2006
14 Apr
'06
8:58 a.m.
Andy Little wrote:
Is the ability to define a function inside another a great win?. The only use is as an argument to functions that iterate through containers like std::for_each AFAICS.
I have certainly reached for them in other circumstances, to scope a 'helper function' as local to the code that needs it. Maybe it's my Pascal background showing through, although I have not actively written pascal for close to a decade now. Usually when I reach for local functions it is purely a scoping mechanism, and I have no interest in accessing local state of the enclosing function. Accessing that state is what seems to bring the complication, but also all the interesting use cases! -- AlisdairM