Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^6: Thoughts on new 'class' OO in upcoming perl

by haj (Vicar)
on Apr 10, 2023 at 21:11 UTC ( [id://11151582]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Thoughts on new 'class' OO in upcoming perl
in thread Thoughts on new 'class' OO in upcoming perl

That gradual change is something I'm not completely happy with - only I fail to come up with a better solution.

Moose did change the convention only a bit: It offers its own new with a key/value API, but also has BUILDARGS and other magic like coercions which allow to mimic practically any existing constructor API. Corinna will not provide the same helpers for backward compatibility. I guess I can live with that, because during the last decade or so I adopted the key/value style anyway.

The "bless vs. new" thing has hit me a lot harder in situations where serialization of objects is needed. Even complex Moose objects can be built from e.g. JSON or YAML strings, and then blessed into the appropriate class. This is no longer possible with Object::Pad or Corinna: You can (re)create their objects only by calling new, undergoing the same API restrictions and validations as for fresh objects. If an object, during its lifetime, achieves a state which is not available by calling new, then... object persistence gets a lot harder.

  • Comment on Re^6: Thoughts on new 'class' OO in upcoming perl

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2026-01-17 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (121 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.