in reply to Indirect Object Syntax
chromatic nicely summarises the parsing problem here:
new Foo has two barewords, and whenever the Perl parser encounters barewords, it has to guess at what they are. Sometimes it has hints at what those barewords are (if it's encountered declarations of filehandles or subroutines) and it can guess correctly. Sometimes it doesn't have hints, because Perl embraces late binding.
See also:
- Turn off indirect object notation - Effective Perler article by brian_d_foy
- Perl Best Practices section 15.12 "Don't use the indirect object syntax"
- Perl Cookbook chapter 13, "A Warning on Indirect Object Notation" section
- Perl::Critic policy to prohibit indirect object call syntax
- How does Perl parse unquoted bare words? (SO by ikegami)
Related:
Added later:
- "open" Best Practices by haukex (2019)
- Optional Subroutine Arguments Like in `print FILEHANDLE LIST` by mikkoi (2023)
- perlobj: Invoking Class Methods: Indirect Object Syntax (perldoc) - "We recommend that you avoid this syntax"
- perl5360delta: use v5.36 (perldoc) - "The 5.36 bundle also disables the features indirect ... will forbid ... the use of "indirect" method calls ... that cause more trouble than they're worth"
- Indirect Object Syntax (perldoc)
- Indirect Object Syntax by Bod (2021)
- Calling a sub without enclosing its argument inside brackets by syphilis (2024)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Indirect Object Syntax
by Bod (Parson) on Nov 07, 2021 at 12:45 UTC | |
by haukex (Archbishop) on Nov 07, 2021 at 13:21 UTC | |
by Bod (Parson) on Nov 07, 2021 at 14:25 UTC | |
by eyepopslikeamosquito (Archbishop) on Nov 07, 2021 at 20:49 UTC | |
by bliako (Monsignor) on Nov 09, 2021 at 09:26 UTC | |
Re^2: Indirect Object Syntax
by ikegami (Patriarch) on Nov 08, 2021 at 17:58 UTC |
In Section
Seekers of Perl Wisdom