Author: lwall Date: 2010-07-17 00:41:33 +0200 (Sat, 17 Jul 2010) New Revision: 31737
Modified: docs/Perl6/Spec/S02-bits.pod docs/Perl6/Spec/S06-routines.pod Log: [S02,S06] change YOU_ARE_HERE to {YOU_ARE_HERE} to better represent the UNIT block Modified: docs/Perl6/Spec/S02-bits.pod =================================================================== --- docs/Perl6/Spec/S02-bits.pod 2010-07-16 22:10:05 UTC (rev 31736) +++ docs/Perl6/Spec/S02-bits.pod 2010-07-16 22:41:33 UTC (rev 31737) @@ -13,8 +13,8 @@ Created: 10 Aug 2004 - Last Modified: 11 Jul 2010 - Version: 219 + Last Modified: 16 Jul 2010 + Version: 220 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -2492,8 +2492,25 @@ a C<MAIN> routine as documented in S06. In this case the ordinary execution of the user's code is suppressed; instead, execution of the user's code is entirely delegated to the setting's C<MAIN> routine, -which calls back to the user's lexically embedded code with C<YOU_ARE_HERE>. +which calls back to the user's lexically embedded code with C<{YOU_ARE_HERE}>. +The C<{YOU_ARE_HERE}> functions within the setting as a proxy for +the user's C<UNIT> block, so C<-n> and C<-p> may be implemented in +a setting with: + + for $*ARGFILES.lines {YOU_ARE_HERE} # -n + map *.say, do for $*ARGFILES.lines {YOU_ARE_HERE} # -p + +or + + map {YOU_ARE_HERE}, $*ARGFILES.lines; # -n + map *.say, map {YOU_ARE_HERE}, $*ARGFILES.lines; # -p + +and the user may use loop control phasers as if they were directly in +the loop block. Any C<OUTER> in the user's code refers to the block +outside of C<{YOU_ARE_HERE}>. If used as a standalone statement, +C<{YOU_ARE_HERE}> runs as if it were a bare block. + Note that, since the C<UNIT> of an eval is the eval string itself, the C<SETTING> of an eval is the language in effect at the point of the eval, not the language in effect at the top of the file. Modified: docs/Perl6/Spec/S06-routines.pod =================================================================== --- docs/Perl6/Spec/S06-routines.pod 2010-07-16 22:10:05 UTC (rev 31736) +++ docs/Perl6/Spec/S06-routines.pod 2010-07-16 22:41:33 UTC (rev 31737) @@ -16,8 +16,8 @@ Created: 21 Mar 2003 - Last Modified: 12 Jul 2010 - Version: 141 + Last Modified: 16 Jul 2010 + Version: 142 This document summarizes Apocalypse 6, which covers subroutines and the new type system. @@ -3300,26 +3300,26 @@ of the current compilation unit. (The C<-n> and C<-p> command-line switches are implemented this way.) In this case the user's mainline code is not automatically executed; instead, execution is controlled -by the setting's C<MAIN> routine. That routine calls C<YOU_ARE_HERE> +by the setting's C<MAIN> routine. That routine calls C<{YOU_ARE_HERE}> at the point where the user's code is to be lexically inserted (in -the abstract). A setting may also call C<YOU_ARE_HERE> outside of +the abstract). A setting may also call C<{YOU_ARE_HERE}> outside of a C<MAIN> routine, in which case it functions as a normal setting, -and the C<YOU_ARE_HERE> merely indicates where the user's code +and the C<{YOU_ARE_HERE}> merely indicates where the user's code goes logically. (Or from the compiler's point of view, which the lexical scope to dump a snapshot of for later use by the compiler as the setting for a different compilation unit.) In this case the execution of the user code proceeds as normal. In fact, the C<CORE> -setting ends with a C<YOU_ARE_HERE> to dump the C<CORE> lexical +setting ends with a C<{YOU_ARE_HERE}> to dump the C<CORE> lexical scope as the standard setting. In this sense, C<CORE> functions as an ordinary prelude. If a C<MAIN> routine is declared both in the setting and in the user's code, the setting's C<MAIN> functions as the actual mainline entry point. The user's C<MAIN> functions in an embedded fashion; -the setting's invocation of C<YOU_ARE_HERE> functions as the main +the setting's invocation of C<{YOU_ARE_HERE}> functions as the main invocation from the point of view of the user's code, and the user's C<MAIN> routine will be invoked at the end of each call to -C<YOU_ARE_HERE>. +C<{YOU_ARE_HERE}>. =head2 Implementation note on autothreading of only subs