Permalink
Browse files

rename eval to EVAL to indicate specialness

EVAL must have a special relationship with the compiler, so don't
pretend it's a normal function/method.  We aren't capitalizing it
because it's a "come from" as most phasers are, but because it's
an escape hatch macro that is mostly there to compensate for an
insufficiently imaginative language designer.

Resolves #50.
  • Loading branch information...
TimToady committed Dec 29, 2013
1 parent 8193f27 commit 0b7df09ecc096eed5dc30f3dbdf568bbfd9de8f6
Showing with 42 additions and 42 deletions.
  1. +8 −8 S02-bits.pod
  2. +6 −6 S04-control.pod
  3. +4 −4 S05-regex.pod
  4. +3 −3 S06-routines.pod
  5. +6 −6 S11-modules.pod
  6. +3 −3 S12-objects.pod
  7. +7 −7 S29-functions.pod
  8. +4 −4 S32-setting-library/Exception.pod
  9. +1 −1 S99-glossary.pod
View
@@ -14,7 +14,7 @@ Synopsis 2: Bits and Pieces
Created: 10 Aug 2004
Last Modified: 28 Dec 2013
- Version: 280
+ Version: 281
This document summarizes Apocalypse 2, which covers small-scale
lexical items and typological issues. (These Synopses also contain
@@ -2066,7 +2066,7 @@ object in a list context, it may be necessary to use C<< prefix:<|> >>
to force interpolation.
Note that C<.perl> has a very specific definition, and it is expected that
-some modules will rely on the ability to roundtrip values with C<eval>. As
+some modules will rely on the ability to roundtrip values with C<EVAL>. As
such, overriding C<.perl> with a different format (globally using
C<MONKEY_TYPING>, or for specific classes unless special care is taken to
maintain parsability) is unwise. Code which does not depend on C<.perl>'s
@@ -2737,12 +2737,12 @@ 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.
+Note that, since the C<UNIT> of an C<EVAL> is the evaluated string itself,
+the C<SETTING> of an C<EVAL> is the language in effect at the point
+of the C<EVAL>, not the language in effect at the top of the file.
(You may, however, use C<OUTER::SETTING> to get the setting of the
-code that is executing the eval.) In more traditional terms, the
-normal program is functioning as the "prelude" of the eval.
+code that is executing the C<EVAL>.) In more traditional terms, the
+normal program is functioning as the "prelude" of the C<EVAL>.
So the outermost lexical scopes nest like this, traversed via C<OUTER>:
@@ -4057,7 +4057,7 @@ the C<list> operator if necessary. A closure in a string establishes
its own lexical scope. (Expressions that sneak in without curlies,
such as C<$(...)>, do not establish their own lexical scope, but use
the outer scope, and may even declare variables in the outer scope, since
-all the code inside (that isn't in an eval) is seen at compile time.)
+all the code inside (that isn't in an C<EVAL>) is seen at compile time.)
The following means the same as the previous example.
View
@@ -12,8 +12,8 @@ Synopsis 4: Blocks and Statements
Created: 19 Aug 2004
- Last Modified: 26 Nov 2013
- Version: 132
+ Last Modified: 28 Nov 2013
+ Version: 133
This document summarizes Apocalypse 4, which covers the block and
statement syntax of Perl.
@@ -99,7 +99,7 @@ context, but closures all work the same on the inside.
Blocks are delimited by curlies, or by the beginning and end of the
current compilation unit (either the current file or the current
-C<eval> string). Unlike in Perl 5, there are (by policy) no implicit
+C<EVAL> string). Unlike in Perl 5, there are (by policy) no implicit
blocks around standard control structures. (You could write a macro
that violates this, but resist the urge.) Variables that mediate
between an outer statement and an inner block (such as loop variables)
@@ -159,8 +159,8 @@ with C<proto>:
If you've referred to C<$x> prior to the first declaration, and the compiler
tentatively bound it to C<$OUTER::x>, then it's an error to declare it, and
the compiler is required to complain at that point. If such use can't
-be detected because it is hidden in an eval, then it is erroneous, since
-the C<eval()> compiler might bind to either C<$OUTER::x> or the subsequently
+be detected because it is hidden in an C<EVAL>, then it is erroneous, since
+the C<EVAL()> compiler might bind to either C<$OUTER::x> or the subsequently
declared "C<my $x>".
As in Perl 5, "C<our $foo>" introduces a lexically scoped alias for
@@ -1038,7 +1038,7 @@ placing a C<CATCH> block I<within> that block that is having its exceptions
handled.
The Perl 6 equivalent to Perl 5's C<eval {...}> is C<try {...}>.
-(Perl 6's C<eval> function only evaluates strings, not blocks, and
+(Perl 6's C<EVAL> function only evaluates strings, not blocks, and
does not catch exceptions.)
A C<try> block by default has a C<CATCH> block that handles all fatal
exceptions by ignoring them. If you define a C<CATCH> block within
View
@@ -16,8 +16,8 @@ Synopsis 5: Regexes and Rules
Created: 24 Jun 2002
- Last Modified: 27 Dec 2013
- Version: 168
+ Last Modified: 28 Dec 2013
+ Version: 169
This document summarizes Apocalypse 5, which is about the new regex
syntax. We now try to call them I<regex> rather than "regular
@@ -195,11 +195,11 @@ or:
Instead of C</ee> say:
- s/pattern/{ eval doit() }/
+ s/pattern/{ EVAL doit() }/
or:
- s[pattern] = eval doit()
+ s[pattern] = doit().EVAL
=item *
View
@@ -16,8 +16,8 @@ Synopsis 6: Subroutines
Created: 21 Mar 2003
- Last Modified: 1 Dec 2013
- Version: 160
+ Last Modified: 28 Dec 2013
+ Version: 161
This document summarizes Apocalypse 6, which covers subroutines and the
new type system.
@@ -27,7 +27,7 @@ new type system.
C<Routine> is the parent type of all keyword-declared code blocks.
All routines are born with undefined values of C<$_>, C<$!>,
and C<$/>, unless the routine declares them otherwise explicitly.
-A compilation unit, such as a module file or an eval string, is also
+A compilation unit, such as a module file or an C<EVAL> string, is also
considered a routine, or you would not be
able to reference C<$!> or C<$/> in them.
View
@@ -14,8 +14,8 @@ Synopsis 11: Units and Modules
Created: 27 Oct 2004
- Last Modified: 26 June 2013
- Version: 39
+ Last Modified: 28 Dec 2013
+ Version: 40
=head1 Overview
@@ -27,7 +27,7 @@ been in Apocalypse 11.
Perl 6 code is compiled per compilation unit, or I<compunit> for short. These
are loaded with a C<use>, C<need> or C<require> statement (usually at compile
time). Or they are created as a string in a variable and compiled with an
-C<eval> statement (usually at runtime). This synopsis is mostly about
+C<EVAL> statement (usually at runtime). This synopsis is mostly about
compunits loaded at compile time.
In the common vernacular of a Perl 5 developer, a I<module> is the same as the
@@ -707,10 +707,10 @@ they are parsing, it is necessary for the tool to know exactly which
variant of Perl 6 is being parsed in any given scope. All Perl 6
compilation units that are complete files start out at the top of the
file in the Standard Dialect (which itself has versions that correspond
-to the same version of the official Perl test suite). Eval strings,
+to the same version of the official Perl test suite). C<EVAL> strings,
on the other hand, start out in the language variant in use at the
-point of the eval call, so that you don't suddenly lose your macro
-definitions inside eval.
+point of the C<EVAL> call, so that you don't suddenly lose your macro
+definitions inside C<EVAL>.
All language tweaks from the start of the compilation unit must
be tracked. Tweaks can be specified either directly in your code as
View
@@ -13,8 +13,8 @@ Synopsis 12: Objects
Created: 27 Oct 2004
- Last Modified: 22 August 2013
- Version: 131
+ Last Modified: 28 Dec 2013
+ Version: 132
=head1 Overview
@@ -50,7 +50,7 @@ There are two basic class declaration syntaxes:
class Bar { has $.bar } # block is class definition
The first form is allowed only as the first declaration in a compilation
-unit (that is, file or eval string).
+unit (that is, file or C<EVAL> string).
If the class body begins with a statement whose main operator is a
single C<< prefix:<...> >> (yada) listop, the class name is introduced
View
@@ -19,8 +19,8 @@ Synopsis 29: Builtin Functions
Created: 12 Mar 2005
- Last Modified: 11 Sep 2013
- Version: 59
+ Last Modified: 28 Dec 2013
+ Version: 60
The document is a draft.
@@ -215,20 +215,20 @@ See L<S06/"The C<callframe> and C<caller> functions">.
See L<S06/"The C<callframe> and C<caller> functions">.
-=item eval
+=item EVAL
- multi eval ( Str|Buf $code, Grammar :$lang = CALLER::<$?PARSER>)
+ macro EVAL ( Str|Buf $code, Grammar :$lang = CALLER::<$?PARSER>)
Execute C<$code> as if it were code written in C<$lang>. If C<$code>
is of type C<Buf>, the same decoding techniques are applied as a compiler
for C<$lang> would usually do to input files.
The default for C<$lang> is the language in effect at the exact
-location of the eval call.
+location of the C<EVAL> call.
Returns whatever C<$code> returns, or fails when the compilation fails.
-Note that unlike in Perl 5, C<eval> does not catch any exceptions or control
+Note that unlike in Perl 5's C<eval>, C<EVAL> does not catch any exceptions or control
exceptions.
=item evalfile
@@ -1041,7 +1041,7 @@ caller
chr
die
do
-eval
+EVAL
exec
exit
fork
@@ -17,8 +17,8 @@ Authors of previous versions of this document:
Created: 26 Feb 2009
- Last Modified: 26 August 2012
- Version: 26
+ Last Modified: 28 Dec 2012
+ Version: 27
The document is a draft.
@@ -218,7 +218,7 @@ So C<&die> could be written as
For errors that arise from compiling code. Note that in this case the
backtrace shows how the
-compilation was triggered (through C<use SomeModule;>, C<eval>s etc.).
+compilation was triggered (through C<use SomeModule;>, C<EVAL>s etc.).
The actual location of the error does not appear in the backtrace, but
rather in the attributes defined in this role.
@@ -1247,7 +1247,7 @@ way that doesn't make sense.
=head2 X::Eval::NoSuchLang
-Thrown when C<eval($str, $lang)> specifies a language that the compiler does
+Thrown when C<EVAL($str, :$lang)> specifies a language that the compiler does
not know how to handle.
my class X::Eval::NoSuchLang is Exception {
View
@@ -251,7 +251,7 @@ yet in the end pleasing nobody, because nobody is catered for enough.
=head2 EPIC FAIL
-=head2 eval
+=head2 EVAL
=head2 Exegesis

0 comments on commit 0b7df09

Please sign in to comment.