On 8/26/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Dr.Ruud wrote: > >> Why do people who write these books have exercises of little > >> practical value? > > > > An exercise needs to be educational. > > I have worked in programming for 25 years and during that time I have never > use a > closure and have never seen one used. I may be harsh in my definitions but > to me > something that is never used is useless. Teaching people to do useless > things is > not educational. snip
So, you have never used sort, map, grep, File::Find::find, or any of the other Higher Order functions? They all take a code block or anonymous function that makes use of closures. Oh, and in my ten years of coding experience I have only been consciously using them for the last six (when I moved from mostly ESQL/C and 4GL to mostly Perl). snip > Objects can do the same things as closures, which is store and hide data, > but don't have this problem of having to keep in mind two phases of the same > code. snip Objects in Perl do not do a very good job of data hiding. In fact, one of the few ways to actually hide data in is to use closures (see perldoc perltoot). You seem to not understand closures or what they are useful for. I would suggest running out and getting Higher Order Perl. It will make you a better programmer (even if you are a good programmer now). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/