Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: The Corinna RFC for getting modern OO into the Perl core is taking shape

by Radiola (Monk)
on Sep 14, 2021 at 10:26 UTC ( [id://11136749]=note: print w/replies, xml ) Need Help??


in reply to Re^3: The Corinna RFC for getting modern OO into the Perl core is taking shape
in thread The Corinna RFC for getting modern OO into the Perl core is taking shape

Only supporting v1.2.3 triplet semantic versioning.

I wouldn't go as far as to call it a "gratuitous incompatibility" since there are no Corinna classes right now which would break because of this. But I agree with you that having decimals would be good: Semantic versioning can be an obstacle in early Corinna adoption. If I want to migrate an existing old-style OO class to Corinna while keeping the API, I would need to change from decimal to semantic - and, worse, users of the class might need to change their code, too.

It's the latter concerns that I consider to be incompatibilities. Corinna isn't coming onto a blank stage. It's part of Perl and has to interoperate with what's out there. Particularly if it ever is going to be able to subclass existing modules (which I don't believe is on the table for the MVP) it needs to support the versioning scheme that those modules use.

No native way to support read/write accessors.

I'm not sure what you're expecting here?

Yeah, I let myself confound the issue of immutability with read/write accessors using the same name. To be fair, the overview (which is what I had read most recently) takes the opportunity to take shots at both at about the same time, too.

But now I think I didn't read the RFC carefully enough, because it appears to be at odds with the Overview on the subject of :reader/:writer on attributes. The Overview says under Helper Attributes:

The writer creates a method called set_$name to avoid overloading the meaning of the method name, and will return the invocant. Setting :reader($name) and :writer($name) to the same $name would be an error.

Whereas the RFC section 6.2.3.3 says:

If you explicity (sic) set the name of the writer to the name of the slot, there will be a special case to allow ->method for reading and ->method($new_value) for writing

So it looks like that's been changed? Or am I missing something else?

– Aaron
Preliminary operational tests were inconclusive. (The damn thing blew up.)

Replies are listed 'Best First'.
Re^5: The Corinna RFC for getting modern OO into the Perl core is taking shape
by Ovid (Cardinal) on Sep 14, 2021 at 15:03 UTC

    But now I think I didn't read the RFC carefully enough, because it appears to be at odds with the Overview on the subject of :reader/:writer on attributes. The Overview says under Helper Attributes: ...

    The wiki is out of date. Specifically, the front page of the repo (the actual RFC part) states:

    Anything in the Wiki should be considered "rough drafts."

    I've now updated the wiki pages with this text. Sorry for the confusion!

Re^5: The Corinna RFC for getting modern OO into the Perl core is taking shape
by haj (Vicar) on Sep 14, 2021 at 13:35 UTC
    So it looks like that's been changed? Or am I missing something else?

    Actually, I have missed the special case to set the name of the writer to the reader's, thanks for pointing that out. The README has a guideline about Wiki vs. RFC inconsistencies:

    You may be looking for the Wiki as that has much historical discussion of this project. However, the documents in the rfc/ folder will be considered the canonical ones.

    There is ongoing discussion on IRC (#cor on libera.chat) and on various GitHub issues. I'd guess that the borderline between "as small as possible" and "make migration of existing code easier" will continue to shift back and forth for some time. Allowing reader=writer is targeted at the Moo* default naming for accessors, but also considered "messy", and the "testbed" Object::Pad (which I'm using for experiments) does not allow it.

    Nothing is cast in stone yet.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-12-07 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (50 votes). Check out past polls.