in reply to Re: Overloading without infinite descent
in thread Overloading without infinite descent (fixed by time: see Perl 5.10.1)
A use case (which is not my actual situation) might go as follows: Imagine that Perl prototypes don't exist, and we're trying to create them. Then one could imagine wanting to write code like this:
so that executingpackage Prototype; use overload '&{}' => sub { my ( $f ) = @_; return sub { check_arguments(@_); goto &$f; }; }; sub i_know_what_im_doing { my $f = shift; goto &$f; }
would check the prototype, but executing$f->(@args)
wouldn't.$f->i_know_what_im_doing(@args)
(It's not a very good use case, because we have to store the prototype somewhere, and, if we are good and store it in the object, then it's easy to find a way around the problem. :-) )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Overloading without infinite descent
by ELISHEVA (Prior) on Aug 03, 2009 at 08:07 UTC |