Skip to content

[doc] pod/perlvar.pod: should the <<>> operator be mentioned more often? #23100

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

Open
vaitkus opened this issue Mar 12, 2025 · 5 comments
Open

Comments

@vaitkus
Copy link
Contributor

vaitkus commented Mar 12, 2025

Where
pod/perlvar.pod

Description
Multiple variables interact with the double diamond operator (<<>>) in the same way they interact with the single diamond operator (<>), e.g. $ARGV, ARGV, $., ${^OPEN}. However, only the ${^OPEN} description explicitly mentions <<>> ("or the related <> and <<>> operators"). I was wondering if it would be worthwhile to modify the other mentions in a similar way as well, e.g. by introducing phrasing like "<>/<<>> operators" instead of "<> operator". On the one hand it is more verbose, on the other, newcomers may not be aware of the <<>> operator at all as the majority of the coding examples in the wild probably use <>.

@khwilliamson
Copy link
Contributor

I remember looking for diamond in perltoc and not finding it. So yes, this is a problem

@Grinnz
Copy link
Contributor

Grinnz commented Apr 24, 2025

It is only mentioned in prose in https://perldoc.perl.org/perlop#I/O-Operators, incidentally the <> operator is not much easier to find documentation for, and is just more well-known in general. I'm not sure the best way forward on this but perlop is difficult to search for specific operators by name in general.

@Grinnz
Copy link
Contributor

Grinnz commented Apr 24, 2025

But as far as mentioning it in perlvar as the OP states, certainly more variable descriptions could use it in examples or descriptions.

@Grinnz
Copy link
Contributor

Grinnz commented Apr 24, 2025

Opened #23224 for the tangentially related issue of finding operators by name.

@vaitkus
Copy link
Contributor Author

vaitkus commented May 4, 2025

@khwilliamson I think that PR #23250 addresses issue #23224 more than it address this one. While mentioning operator by name greatly improves the documentation, my original inquiry was more about the double diamond operator often being omitted in variable descriptions where it might make sense to mention it alongside the regular diamond operator, e.g. see the $ARGV description:

    Contains the name of the current file when reading from <>.

@Grinnz Grinnz reopened this May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants