Tels wrote:
>
> Did you patch it? Otherwise IMHO it is not "resolved", because the workaround
> presented:
>
> * is just a workaround, no real solution (it would be neccessary to put the
> workaround into _each_ class, instead of _once_ into overload)
> * doesn't even work properly (the presented workaround has small bugs)
> * re-inventes the wheel: by hunting down which class to call we do exactly
> what overload.pm solves: overloading a specific class method)
> * it poses problems (what if different classes try to workaround and all
> globber CORE::GLOBAL::log together?)
Indeed ; and I believe better solutions can be found.
However, in a few words, here's why I closed this bug :
overloading an operator is intended to modify its behaviour while
retaining its syntax.
Currently you can write this and rely on it :
$ perl -e 'print log 2.718, "\n"'
0.999896315728952
and you can do this also by replacing 2.718 by any $variable.
If you're using a modified log() that takes an optional 2nd argument, you're
forced to know at compile-time that the second item is going to be an argument
to log() and not to print().
I don't think it's possible to get this right in a satisfying way through
overloading. At some point you will need to teach the parser that you've
modified the log() function, or you'll end up with an unfinished solution.
> I am in the process of trying to understand overload.pm - but this takes more
> time. The best I can come up is some comment&doc patch for now. Hopefully
> this will lead to enough documentation so that this can be either fixed or
> documented as "unfixable".
Enhancements welcomed, as always.
Thread Previous