-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback on the Moo/se to Corinna porting guide #58
Comments
Can a class attribute (I hate the term 'field'!) be passed to the constructor by adding :param to its definition? |
@abraxxa By default, no. Constructor args are for creating an instance. You can get make this work with an alternate constructor, but generally, it's good practice—if you must use class data—to have it be immutable if classes use it. Otherwise, you can get nasty "action at a distance." |
I had no idea about the make_immutable method. First, thank you. Second, I had to search with a few keywords, could a direct link be provided, like to https://metacpan.org/dist/Moose/view/lib/Moose/Cookbook/Basics/Immutable.pod ? |
@jgamble Done! Thanks for the suggestion. Also, there's another doc I'm not linking it in the guide because it would be a distraction, but you might find the make_immutable options to be of interest, too. |
@Ovid maybe we could start by trying to port the Moose tutorial? |
Since Moose doesn't do class attributes in its core feature maybe that bit should be left out. There's actually controversy on the best way to handle class attributes, maybe people don't use MooseX::ClassAttribute. I would suggest if this is a porting guide that we focus more on Moose features, how they are handled in Cor and workarounds for things the Cor doesn't do. |
@abraxxa I like 'field'. I'm glad they decided to not use 'has'. That way we can write a "Cor::MooseLike" that does define a 'has' to help smooth over differences and make porting easier. I remember with Moose we created MooseX::Emulate::Class::Accessor::Fast to help speed along porting of code that used Class::Accessor, which was very popular pre Moose days. |
We'll probably need a separate guide for handling the more common MooseX extensions. There's tons of those but a lot of them are not particularly popular. I wonder how to figure out which ones are a big deal and need to be discussed. |
I wouldn't suggest 'has' but 'attribute', as that's what every OO coding guide and other languages calls it. |
attribute is unfortunately out of the question, because it is already a Perl feature (which Corinna itself uses). |
I don't see a keyword named 'attribute' there. |
^--
^-- as are These things are all called "attributes" and have been for the past ~20 or so years that Perl has had them. |
Yes, and how does that prevent us from defining attributes using the keyword attribute? |
It would be very very confusing to have two totally-distinct concepts, both called "attributes". Especially if these object fields can have attributes themselves. How would you distinguish
is Distinct concepts must have distinct names - this is an essential part of any language; computer or otherwise. |
Those things after the double-colons don't need to be named the same as the existing sub attributes. |
@jjn1056 Porting the Moose tutorial actually is a great idea. I just avoided it because of time constraints. It would also be interesting because it would show the limitations of the Corinna MVP and how to work around them. |
@abraxxa I know where you're coming from, but we've been arguing over the color of this particular bikeshed for years. It went from |
For the record, when I looked at other dynamic languages, the term property
was more used than attribute.
…On Sat, Feb 26, 2022, 10:54 Ovid ***@***.***> wrote:
@abraxxa <https://github.com/abraxxa> I know where you're coming from,
but we've been arguing over the color of this particular bikeshed for
years. It went from has to slot to field, with many people expressing
considerable relief at the latter. It's just one of those situations, like
using :common for class-based behavior, that we have to work around the
existing language.
—
Reply to this email directly, view it on GitHub
<#58 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFURPKSJHEAH7YF7ZTW43I3U5CINDANCNFSM5O7KMH7Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I have an incomplete guide to porting Moo/se to Corinna: https://github.com/Ovid/Cor/wiki/Porting-from-Moose-or-Moo
Please leave feedback here.
Yes, it will eventually need to be several documents.
The text was updated successfully, but these errors were encountered: