
On 2/4/2011 3:39 PM, Phil Endecott wrote:
No, it's not only you. I'd probably write something like that if a simple bind(&fn,_1) were insufficient.
The main complaint about that from the advocates of both Pheonix and Local seems to be that it's too far from the point of use. Well, I have to ask how big your functions are, and if they're huge, why? Also do you dislike code like this:
void f1(args) { ........ }
void my_big_fn() { .... .... .... f1(a); // using a function only to avoid duplicating the f1(b); // same code for a and b. .... }
because the definition of f1 is far from where it's used? Would you countenance using a macro instead:?
#define f1(arg) .... f1(a); f1(b);
Perhaps it comes down to this: we're used to functions being relatively far from where they're used because it has always been like that, but we think of these lambda expressions as taking the place of the body of a loop, and we're not used to that being out-of-line.
Anyway, I'm just going to wait for C++0x lambdas.
+10000