develooper Front page | perl.perl5.porters | Postings from June 2004

Re: FW: File::Find modified to pass arguments to the wantedfunction (with attachment)

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
June 1, 2004 08:03
Subject:
Re: FW: File::Find modified to pass arguments to the wantedfunction (with attachment)
Message ID:
20040601150302.7519.3@llama.elixent.com
Gisle Aas <gisle@ActiveState.com> writes:
>> 
>> It's not always convenient to do that.
>
>The sub{} wrapper will seldom be much more typing than providing args
>any another way, so I don't find it very inconvenient either.
>
>The Tk-style for providing callback args actually do save a little bit
>of typing:
>
>   find([\&foo, $bar], @files);
>   find(sub { foo($bar) }, @files);

Is find prototyped so that 

    find { foo($bar) } @files 

would work?

>Have anybody ever done a survey of which Perl callback APIs provide
>args to be passed back and which do not?  I certainly tend to not
>provide a way to pass args that as closures gives enough hooks as it
>is.

FWIW if closures had existed when I did 1st Tk port the Tk way would
probably never have been invented.

I occasionaly try and think of ways to conver Tk style (less typing)
into closure style to avoid a pile of messy "convert [] to call" code.



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About