Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by LanX (Saint)
on Aug 29, 2018 at 14:43 UTC ( [id://1221307]=note: print w/replies, xml ) Need Help??


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

I don't consider me an expert in OO beyond standard perldocs ...

... but from a strategic POV all remodeling in P5 should try to stay as close as possible to the semantics of P6. (NB: semantic != syntax)

Any divergence should have good reasons.

Why?

  • Much thoughts were already invested in designing P6, so why reinvent the brain wheels?
  • We should facilitate a later migration
  • We could profit from synergies in later development.

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

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

Replies are listed 'Best First'.
Re^2: OO systems and Perl 5 (Was: Recap: Future of Perl 5)
by chromatic (Archbishop) on Aug 29, 2018 at 18:04 UTC
    Any divergence should have good reasons.

    To expand on my comment in Re^5: Recap: The Future of Perl 5, any of the P6 OO semantics which assume stronger type guarantees and identities will be troublesome to implement in Perl. Smartmatch is the best example of that, but type coercions will also be interesting (and not in the fun way).

      Not sure what type indenties mean°, but stronger type guarantees could at least happen at runtime, or am I missing something?

      Perl 5 already allows to define a type in declarations (see my ) but alas it's only (mostly) a placebo. Would be interesting to know what the plan was...

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

      update

      °) you probably mean what JS is handling by the difference between == and === ?

Re^2: OO systems and Perl 5 (Was: Recap: Future of Perl 5)
by RonW (Parson) on Aug 29, 2018 at 23:01 UTC

    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.)

      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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1221307]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2024-04-23 10:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found