Spoiled
2005-04-22 20:59:19.574395+00 by Dan Lyke 6 comments
2005-04-22 20:59:19.574395+00 by Dan Lyke 6 comments
[ related topics: Perl Software Engineering Python ]
comments in ascending chronological order (reverse):
#Comment Re: made: 2005-04-22 21:48:18.406314+00 by: meuon
Wow.. I learned something. And found PHP Fakes this functionality a bit with create_function()
http://us4.php.net/create_function
#Comment Re: made: 2005-04-23 02:16:33.214579+00 by: ebradway
And the comments from meuon's link:
"Basically, if create_function() is the answer, you arn't asking the right question"
Beware self-modifying code! I could see Perl providing this kind of functionality and I guess PHP and Python have to follow in step. And Dan has obviously taken quite a breather from C/C++ if he thinks "function pointers would make the code harder to read".
#Comment Re: made: 2005-04-23 09:35:44.971325+00 by: meuon
I have only used eval a few times in Perl, and yes, am very wary of self-modifying code (I've blown it up some). And have not yet needed such functionality in my PHP projects. But that same comment said "Chessmasters can do it because they know what they're doing. Beginners and intermediates, however, are quick to attack (use it) without recognizing the long term danger.".
I'll consider Dan a chessmaster doing things that would probably work well if he was using a lambda facility....
#Comment Re: made: 2005-04-23 11:30:34.982912+00 by: DaveP
Tried Boost? Boost Lambda works in almost all C++ compilers.
#Comment Re: made: 2005-04-23 15:17:38.90676+00 by: aiworks
If function pointers would solve the problem at the expense of usability, why not use function objects? Better yet, if iterating over lists different ways is the issue, look at the built-in STL function objects (there's lots of wonky container iteration options).
#Comment Re: made: 2005-04-23 17:42:43.692521+00 by: Dan Lyke
Hmmm... Thanks for the reminder about templates, I'll go refresh myself.
The main concern with any external encapsulation, be it function pointers or classes with methods is that they'd pull the code out of the flow. Templates, on the other hand...