
What's wrong with: std::for_each ( as.begin , as.end() , bool some_function_keyword(A& a) { return a.wee() & SOME_FLAG; } );
I think the previous poster (whos comments where appreciated) implied that while some languages (he mentioned Lisp and Perl I think, and I mentioned Java) could/do support this, C++ would struggle to. It would make things hairy for the compiler because a function definition is not preceeded by any keyword. I think you can also do things a bit like this in java ... Interesting perhaps that there is a keyword involved in this case, would this still bog down compilers so much as to outweight the advantages of the sytax style (assuming there are any, I'm happy to be argued out of thiking this kind of coding is neat). button_click_event.set_handler ( new class : public button_click_event_handler { void on_click() { std::cout << "anon_class::on_click() : printing wee" << std::endl; } } );
I don't know what a good function keyword name would be. Obviously: fn, function, lambda are in common use everywhere (and fn is too short for a C++ keyword! :D) Reuse 'inline'?
I suppose inline would make sense, but it might be a bit of a hack to have it used in two senses. I wonder if you can do this stuff in Delphi, they have a function keyword. Thesaurus :) " function noun 1. The proper activity of a person or thing: job, purpose, role, task. See do/not do. 2. A large or important social gathering: affair, celebration, festivity, fete, gala, occasion, party, soiree. Informal do. Slang bash. See group, work/play. verb 1. To react in a specified way: act, behave, operate, perform, work. See action/inaction. 2. To perform a function effectively: go, operate, run, take, work. See thrive/fail/exist. 3. To perform the duties of another: act, officiate, serve. See do/not do, substitute. " Cheers for the responses anyway, Gaz