Author: larry Date: Fri Aug 8 07:59:12 2008 New Revision: 14573 Modified: doc/trunk/design/syn/S02.pod doc/trunk/design/syn/S06.pod doc/trunk/design/syn/S13.pod
Log: clarify that &foo is a real function even when representing a multiple dispatch s/q:code/quasi/ Modified: doc/trunk/design/syn/S02.pod ============================================================================== --- doc/trunk/design/syn/S02.pod (original) +++ doc/trunk/design/syn/S02.pod Fri Aug 8 07:59:12 2008 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 10 Aug 2004 - Last Modified: 5 Aug 2008 + Last Modified: 8 Aug 2008 Number: 2 - Version: 134 + Version: 135 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -1503,9 +1503,11 @@ =item * -With multiple dispatch, C<&foo> may not be sufficient to uniquely name a -specific function. In that case, the type may be refined by using a -signature literal as a postfix operator: +With multiple dispatch, C<&foo> may actually be the name of a set +of candidate functions (which you can use as if it were an ordinary function). +However, in that case C<&foo> by itself is not be sufficient to uniquely +name a specific function. To do that, the type may be refined by +using a signature literal as a postfix operator: &foo:(Int,Num) @@ -2455,7 +2457,7 @@ macro qx { 'qq:x ' } # equivalent to P5's qx// macro qTO { 'qq:x:w:to ' } # qq:x:w:to// - macro quote:<❰ ❱> ($text) { q:code{ $text.quoteharder } } + macro quote:<❰ ❱> ($text) { quasi { $text.quoteharder } } All the uppercase adverbs are reserved for user-defined quotes. All Unicode delimiters above Latin-1 are reserved for user-defined quotes. Modified: doc/trunk/design/syn/S06.pod ============================================================================== --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Fri Aug 8 07:59:12 2008 @@ -2490,10 +2490,10 @@ =head2 Quasiquoting In aid of returning syntax tree, Perl provides a "quasiquoting" -mechanism using the quote C<q:code>, followed by a block intended to +mechanism using the quote C<quasi>, followed by a block intended to represent an AST: - return q:code { say "foo" }; + return quasi { say "foo" }; Modifiers to the C<:code> adverb can modify the operation: @@ -2508,7 +2508,7 @@ To make a symbol resolve to the (partially compiled) scope of the macro call, use the C<COMPILING::> pseudo-package: - macro moose () { q:code { $COMPILING::x } } + macro moose () { quasi { $COMPILING::x } } moose(); # macro-call-time error my $x; @@ -2545,15 +2545,15 @@ "unquoted" expression of either type within a quasiquote, use the quasiquote delimiter tripled, typically a bracketing quote of some sort: - return q:code { say $a + {{{ $ast }}} } - return q:code [ say $a + [[[ $ast ]]] ] - return q:code < say $a + <<< $ast >>> > - return q:code ( say $a + ((( $ast ))) ) + return quasi { say $a + {{{ $ast }}} } + return quasi [ say $a + [[[ $ast ]]] ] + return quasi < say $a + <<< $ast >>> > + return quasi ( say $a + ((( $ast ))) ) The delimiters don't have to be bracketing quotes, but the following is probably to be construed as Bad Style: - return q:code / say $a + /// $ast /// / + return quasi / say $a + /// $ast /// / (Note to implementors: this must not be implemented by finding the final closing delimiter and preprocessing, or we'll violate our @@ -2588,17 +2588,17 @@ the text determines subsequent expectations.) Quasiquotes default to hygienic lexical scoping, just like closures. -The visibility of lexical variables is limited to the q:code expression +The visibility of lexical variables is limited to the quasi expression by default. A variable declaration can be made externally visible using the C<COMPILING::> pseudo-package. Individual variables can be made visible, or all top-level variable declarations can be exposed using the -C<q:code(:COMPILING)> form. +C<quasi :COMPILING> form. Both examples below will add C<$new_variable> to the lexical scope of the macro call: - q:code { my $COMPILING::new_variable; my $private_var; ... } - q:code(:COMPILING) { my $new_variable; { my $private_var; ... } } + quasi { my $COMPILING::new_variable; my $private_var; ... } + quasi :COMPILING { my $new_variable; { my $private_var; ... } } (Note that C<:COMPILING> has additional effects described in L<Macros>.) Modified: doc/trunk/design/syn/S13.pod ============================================================================== --- doc/trunk/design/syn/S13.pod (original) +++ doc/trunk/design/syn/S13.pod Fri Aug 8 07:59:12 2008 @@ -233,6 +233,4 @@ $someclass = generate_class(); $someclass($x); -=cut - =for vim:set expandtab sw=4: