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