develooper Front page | perl.perl5.porters | Postings from September 2016

Re: I'd like to get rid of "use UNIVERSAL;"

Thread Previous | Thread Next
From:
David Cantrell
Date:
September 27, 2016 12:17
Subject:
Re: I'd like to get rid of "use UNIVERSAL;"
Message ID:
20160927121738.GB19611@bytemark.barnyard.co.uk
On Tue, Sep 27, 2016 at 12:39:58PM +0100, Dagfinn Ilmari Manns?ker wrote:
> David Cantrell <david@cantrell.org.uk> writes:
> > On Mon, Sep 26, 2016 at 10:32:11PM +0200, ?var Arnfj?r? Bjarmason wrote:
> >> But technically this does break backwards compatibility without a
> >> deprecation cycle. Because "use UNIVERSAL;" isn't an error today, and
> >> some code on the CPAN redundantly uses that.
> > You'll also break this:
> >   use UNIVERSAL;
> >   ...
> >   if(UNIVERSAL::isa($foo, 'Some::Class')) { ...
> This continues to "work"

The proposal is to make it not work.

>                          and never required 'use UNIVERSAL', since the
> function is provided by universal.c, not UNIVERSAL.pm.

I doubt that many people are aware of that, and that even fewer of them
understand what that means.

Anyway, the string 'use UNIVERAL;' appears in 74 dists on the CPAN
according to grep.cpan.me. At least some of them are completely
redundant in that the file that includes it doesn't also include a call
to UNIVERSAL::isa or its friends (presumably it used to in an earlier
version and the 'use' hasn't been deleted), but not all are.

-- 
David Cantrell | A machine for turning tea into grumpiness

    Wow, my first sigquoting! I feel so special now!
        -- Dan Sugalski

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About