in reply to Re^2: OO systems and Perl 5 (Was: Recap: Future of Perl 5)
in thread OO systems and Perl 5 (Was: Recap: Future of Perl 5)
UNIVERSAL.pm itself is not so important. It's mostly just documentation. The guts of the UNIVERSAL package (UNIVERSAL::can, UNIVERSAL::isa, UNIVERSAL::DOES) are hard-coded into Perl, not part of a module.
The disadvantage of having UNIVERSAL::new is that all packages automatically inherit from UNIVERSAL; even ones not designed to be used as classes. How much sense do things like this make?
use strict; my $thing = strict->new;
A whole lot of modules would need to add code like this to them:
sub new { # override UNIVERSAL::new require Carp; Carp::croak("$_[0] is not a class"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: OO systems and Perl 5 (Was: Recap: Future of Perl 5)
by RonW (Parson) on Aug 31, 2018 at 00:11 UTC | |
by LanX (Saint) on Aug 31, 2018 at 01:44 UTC |
In Section
Meditations