[% setvar title Named operators versus functions %]
To see what is currently happening visit http://www.perl6.org/
Named operators versus functions
Maintainer: Johan Vromans <email@example.com> Date: 4 Aug 2000 Last Modified: 28 Aug 2000 Mailing List: firstname.lastname@example.org Number: 26 Version: 2 Status: Frozen
Perl distinguishes named operators and functions. For Perl6, this disctinction can be dropped.
Named operators, like
abs, can be called like functions in which
case they behave like functions. This has always been so in Perl.
Recent versions of Perl allow user-defined functions to be called as operators, using context coercion templates to resolve argument passing.
Larry said: "Theoretically, we'd like to make subs run as fast as ops."
Since there is no real difference between named operators and functions anymore, they can be treated identically. The difference in terminology can be applied to how it is called instead of how it is defined.
So, a function is a user-defined or built-in function called with a parenthesized list of arguments, and a named operator is a user-defined or built-in function called with its arguments "bare". The latter form is subject to the usual restrictions.
Note that this applies to the language aspects. The actual implementation may be different for user-defined and built-in functions.
After the first release we had some discussions on perl6-language. These discussions didn't add any new insights. The discussion is over, and it's now up to Larry to decide.
[i] perldoc perlop