On Wed, Jul 20, 2005 at 11:33:01PM -0400, Randy W. Sims wrote:
> >"use base" sucks. It uses horrible heuristics to do its thing and gets
> >things wrong disturbingly often. IMO its much preferable to avoid it.
> >As an example play around with it with multiple packages in a single
> >file, likewise play around with evaling packages into existance at run
> >time, and watch use base act like its been smoking crack.

What do you expect it to do in these cases?  "use base" happens at compile
time.  In the case of the eval your class comes into existence at run time. 
In the multi package one I assume you're thinking of this:

        package Foo;
        use base 'Bar';

        package Bar;
        $bar = 42;

Where, similar problem, "use base 'Bar'" happens at compile time so Bar
does not yet exist.

The only solution I can think of is to remove the checks that the base 
class exists.  Or if there was some way for "base" to defer its checks
until after its caller has finished compiling, but I don't think that's
possible.


> What would break if base.pm checked %:: to see if the package is defined 
> /after/ it fails the C<eval "require $base"> ?  That would seem to solve 
> a large class of problems.

It does do that.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
You are wicked and wrong to have broken inside and peeked at the
implementation and then relied upon it.
        -- tchrist in <[EMAIL PROTECTED]>

Reply via email to