Skip to content

Conversation

0rir
Copy link
Contributor

@0rir 0rir commented Feb 21, 2025

Split the Language/5to6-perlop/The_arrow_operator section into 3 paragraphs.

Changed the fat arrow redirect to the more local 5to6-perlop#Comma_operator. And put it first.

Reduced the text of the central point into the second paragraph. Making a change so the first sentence need not be corrected by the second.

The third pargraph briefly states the ->'s Raku purpose with links.

My "dereferencing is rare in Raku" seems justified in my slight experience and by JJ's tone. If not so, advise.

The dereferencing operator, C«->», is replaced by the dot, which is
also used for method calls. So Perl's C«$arrayref->[7]» becomes
Raku's C<$arrayref.[7]> and C«$user->name» becomes C<$user.name>.
Note that dereferencing is rare in Raku.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add: and that $arrayref[7] is also valid syntax for positional access (losing the dot).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this well. A few times, IIRC, I have needed a dot to get an array index to work. I am fairly sure that it was in map 's Callable parameter. So there is something like indirection that comes up rarely. JJ seems to be making that distinction.

If that distinction is real, your addition would be better placed with 5to6's guidance about Arrays.

I'll try checking the dot-reference-op's sources, with modest hope of success.

@lizmat
Copy link
Collaborator

lizmat commented Feb 21, 2025

.[42] is short for $_[42], perhaps that's where you got that notion from? The dot is needed, as [42] is syntax for an array with a single element: 42.

@0rir
Copy link
Contributor Author

0rir commented Feb 22, 2025

@lizmat, I don't think so; I loved the vanishing topic at first non-sight. A named var or a Whatever, or finding a dot instead of a trait's double parens.

Maybe @JJ can say why he mentioned dereferencing.

@JJ
Copy link
Contributor

JJ commented Feb 23, 2025

It would help if I had a bit of context. Are you talking about an issue, about what's actually written there which I wrote (found by blame)? I'll try to go for both, but will need some time figuring out, I'm afraid.

@JJ
Copy link
Contributor

JJ commented Feb 23, 2025

OK, I have a bit of context here now. My 2¢ (taking into account that the only thing I did with this piece of documentation is changing Perl(non-breaking-whitespace)6 to raku)

  1. I don't think people are coming to Raku from the Perl community, so my first impulse for these pages would be just to consider them technical debt and eliminate them.
  2. Fixing something that has not been broken (i. e. does not have an issue) is always a difficult proposition, if not for anything else because it's difficult to evaluate what's right or wrong. That applies also to documentation. And there's effectively an issue with these pages: Tone of 5-6 articles #4467 which mainly talks about the "tone". That might not be in scope, but as long as you're changing some piece of code affected by that issue, you should try and help with that.
  3. Talking about dereferencing should maybe receive some context, such as a link to this FAQ to the tune of "talking about taking references [and de-referencing]) doesn't make much sense. We're talking about arrows, however, so maybe it would be more useful to just say what an arrow means in Raku if the (rare) Perl user bumps into it.

@lizmat lizmat changed the title 5to6 Split 5to6 section into 3 paragraphs Feb 24, 2025
@0rir
Copy link
Contributor Author

0rir commented Feb 27, 2025

@JJ, You have my apology for my poor blame reading.

Whenever altering the docs or code, I will try to improve the readability, that includes tone, brevity, flow, and use of an extended international English.

I think mentioning Raku's use of -> is more worthwhile than it's off-topicness. I found some claims of Raku's Perl-likeness to be misleading. Pointing out homonyms across languages is helpful.

If there is no dereferencing happening with the dot, then that can be deleted.

What confuses me is the applicability of this "dereferencing" to: $object.callable-trait()($arg), and its dotty version $object.callable-trait.($arg). My leaning is not appllicable, but that relies on my chosen level of abstraction. That level may be odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants