Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: OO systems and Perl 5 (Was: Recap: Future of Perl 5)

by RonW (Parson)
on Aug 29, 2018 at 23:01 UTC ( #1221337=note: print w/replies, xml ) Need Help??


in reply to Re: OO systems and Perl 5 (Was: Recap: Future of Perl 5)
in thread OO systems and Perl 5 (Was: Recap: Future of Perl 5)

A suitable implementation of UNIVERSAL::new could provide similar default behavior to Perl 6's new. So could a suitable implementation of UNIVERSAL::init - and would be more friendly to "immigrants" from other languages' OO systems - Class::init will be called with an already blessed object, so will only need to perform initializations (and, maybe, validate supplied parameters). (Not surprisingly, overriding new in Perl 6 requires the new class's new method to use bless to create the new object.)

  • Comment on Re^2: OO systems and Perl 5 (Was: Recap: Future of Perl 5)

Replies are listed 'Best First'.
Re^3: OO systems and Perl 5 (Was: Recap: Future of Perl 5)
by LanX (Archbishop) on Aug 30, 2018 at 00:56 UTC
    Unfortunately ammending UNIVERSAL will certainly break some CPAN modules.

    Just imagine packages trying to catch new in AUTOLOAD.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Unfortunately, true.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1221337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2019-06-19 21:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (89 votes). Check out past polls.

    Notices?