Author: larry Date: Sun Apr 30 10:43:33 2006 New Revision: 9042 Modified: doc/trunk/design/syn/S02.pod doc/trunk/design/syn/S03.pod doc/trunk/design/syn/S04.pod doc/trunk/design/syn/S12.pod
Log: Long dot is now introduced by backslash. Modified: doc/trunk/design/syn/S02.pod ============================================================================== --- doc/trunk/design/syn/S02.pod (original) +++ doc/trunk/design/syn/S02.pod Sun Apr 30 10:43:33 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 10 Aug 2004 - Last Modified: 26 Apr 2006 + Last Modified: 30 Apr 2006 Number: 2 - Version: 34 + Version: 35 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -141,33 +141,35 @@ =item * -In addition to the general comment forms above, there is a whitespace-only -comment form that begins and ends with a single dot, separated by whitespace, +In addition to the general comment forms above, there is a +whitespace-only comment form that begins with backslash and ends +with a single dot, separated by 0 or more characters of whitespace, which is equivalent to a single dot: - %hash. .{$key} - @array. .{$key} + %hash\ .{$key} + @array\ .[$ix] + $subref\.($arg) This is useful for lining up postfixes. This is known as the "long dot", -partly because it substitutes for a dot without the need for a third dot: +partly because it substitutes for a dot without the need for an extra dot: - $object. .say(); + $object\ .say(); The whitespace in the middle may include any of the comment forms above. -Because comments always count as whitespace, the dots in +Because comments always count as whitespace, the C<\.> in - $object.#{ foo }.say + $object\#{ foo }.say reduce to a "long dot" rather than the range operator. Valid ways to insert a line break into a sequence of method calls include: - $object. # comment + $object\ # comment .say - $object.#[ comment + $object\#[ comment ].say - $object. + $object\ .say =item * @@ -659,8 +661,8 @@ corresponding C<.()> operator, plus the "long dot" forms that allow you to insert optional whitespace and comments between dots: - &foo. .($arg1, $arg2); - &foo.#[ + &foo\ .($arg1, $arg2); + &foo\#[ embedded comment ].($arg1, $arg2); Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Sun Apr 30 10:43:33 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 26 Apr 2006 + Last Modified: 30 Apr 2006 Number: 3 - Version: 24 + Version: 25 =head1 Changes to existing operators @@ -802,8 +802,8 @@ I<long dot> syntax: %monsters.{'cookie'} = Monster.new; - %people. .{'john'} = Person.new; - %cats. .{'fluffy'} = Cat.new; + %people\ .{'john'} = Person.new; + %cats\ .{'fluffy'} = Cat.new; =head1 Precedence Modified: doc/trunk/design/syn/S04.pod ============================================================================== --- doc/trunk/design/syn/S04.pod (original) +++ doc/trunk/design/syn/S04.pod Sun Apr 30 10:43:33 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 19 Aug 2004 - Last Modified: 25 Apr 2006 + Last Modified: 30 Apr 2006 Number: 4 - Version: 18 + Version: 19 This document summarizes Apocalypse 4, which covers the block and statement syntax of Perl. @@ -674,7 +674,7 @@ if $term{$x} # subscript because postfix expected if $term {$x} # expression followed by statement block if $term.{$x} # valid subscript with dot - if $term. .{$x} # valid subscript with "long dot" + if $term\ .{$x} # valid subscript with "long dot" Similar rules apply to array subscripts: @@ -682,7 +682,7 @@ if $term[$x] # subscript because postfix expected if $term [$x] # syntax error (two terms in a row) if $term.[$x] # valid subscript with dot - if $term. .[$x] # valid subscript with "long dot" + if $term\ .[$x] # valid subscript with "long dot" And to the parentheses delimiting function arguments: @@ -690,7 +690,7 @@ if $term($x) # function call because operator expected if $term ($x) # syntax error (two terms in a row) if $term.($x) # valid function call with dot - if $term. .($x) # valid function call with "long dot" + if $term\ .($x) # valid function call with "long dot" Outside of any kind of expression brackets, a final closing curly on a line (not counting whitespace or comments) always reverts Modified: doc/trunk/design/syn/S12.pod ============================================================================== --- doc/trunk/design/syn/S12.pod (original) +++ doc/trunk/design/syn/S12.pod Sun Apr 30 10:43:33 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 27 Oct 2004 - Last Modified: 6 Apr 2006 + Last Modified: 30 Apr 2006 Number: 12 - Version: 13 + Version: 14 =head1 Overview @@ -221,7 +221,7 @@ .doit() # okay, no arguments .doit () # ILLEGAL (two terms in a row) .doit.() # okay, no arguments, same as .doit() - .doit. .() # okay, no arguments, same as .doit() (long dot form) + .doit\ .() # okay, no arguments, same as .doit() (long dot form) However, you can turn any of the legal forms above into a list operator by appending a colon: @@ -230,7 +230,7 @@ .doit(1): 2,3 # okay, one argument plus list .doit (): 1,2,3 # ILLEGAL (two terms in a row) .doit.(1): 2,3 # okay, same as .doit(1,2,3) - .doit. .(1,2): 3 # okay, same as .doit(1,2,3) + .doit\ .(1,2): 3 # okay, same as .doit(1,2,3) In particular, this allows us to pass a closure in addition to the "normal" arguments: