On 10/09/01 Benjamin Stuhl wrote:
> Unfortunately, compiler tricks only work at compile time.
> They're great for static languages like C++ or C#, but Perl
> supports doing
> 
> %CORE::GLOBAL::{'&print'} = \&myprint;
> 
> at _runtime_. This is much to late to be going back and
> patching up any occurences of print_p in the opstream, so
> we need a level of indirection on every overridable opcode.
> (Note that the _overloadable_ ones like the math routines
> don't need that level of indirection - they get it by
> vectoring through the PMC vtables).

And the same is supposed to happen when you override print,
since print is just a method in the Stream 'class' or
whatever it's going to be called.
If there is a 'print' opcode the implementation should do
something like:

        case PRINT_OP:
                interp->current_stdout->vtable->print (...);

and that will do the right thing anyway.

lupus

-- 
-----------------------------------------------------------------
[EMAIL PROTECTED]                                     debian/rules
[EMAIL PROTECTED]                             Monkeys do it better

Reply via email to