Author: larry Date: Thu Jan 4 13:44:32 2007 New Revision: 13510 Modified: doc/trunk/design/syn/S03.pod
Log: Hyper ops must degenerate gracefully to scalar ops for non-lists. Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Thu Jan 4 13:44:32 2007 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 23 Dec 2006 + Last Modified: 4 Jan 2007 Number: 3 - Version: 82 + Version: 83 =head1 Changes to PerlĀ 5 operators @@ -847,7 +847,7 @@ their ASCII digraphs C<<< >> >>> and C<<< << >>> are used to denote a "list operation" that operates on each element of its list (or array) argument (or arguments) and returns a single list (or array) of -the results. In otherwords, a hyper operator evaluates its arguments in +the results. In other words, a hyper operator evaluates its arguments in scalar context but then distributes the operator over them as lists. When writing a hyper operator, spaces are not allowed on the inside, @@ -911,6 +911,13 @@ the last element of the list were arbitrarily replicated C<*> times. But this happens only on the "dwimmy" side. +On the non-dwimmy side, any scalar value that does not know how to +do C<List> will be treated as a list of one element, and for infix +operators must be matched by an equivalent one-element list on the +other side. That is, a hyper operator is guaranteed to degenate +to the corresponding scalar operation when all its arguments are +non-list arguments. + When using a unary operator, you always aim the blunt end at the single operand, because no dwimmery ever happens: