Skip to content

Commit 649b9e9

Browse files
committed
Moves EVAL as method back to Cool
Also eliminates implementation details from EVAL. Closes #2822
1 parent 94ff45f commit 649b9e9

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

doc/Type/Cool.pod6

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ imaginary part negated).
142142
143143
say (1+2i).conj; # OUTPUT: «1-2i␤»
144144
145+
=head2 routine EVAL
146+
147+
Defined as:
148+
149+
=for code :method
150+
method EVAL(*%_)
151+
152+
It calls the L<subroutine form|/type/independent-routines#sub_mkdir> with the
153+
invocant as the first argument, C<$code>, passing along named args, if any.
154+
155+
145156
=head2 routine sqrt
146157
147158
Defined as:

doc/Type/independent-routines.pod6

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,18 @@ actually attached to any particular class or role.
1212
Defined as:
1313
1414
=begin code :method
15-
method EVAL(*%_)
16-
=end code
17-
=begin code :method
18-
proto sub EVAL($code is copy where Blob|Cool|Callable, Str() :$lang = 'perl6',
15+
proto sub EVAL($code where Blob|Cool|Callable, Str() :$lang = 'perl6',
1916
PseudoStash :$context, *%n)
2017
=end code
2118
=begin code :method
2219
multi sub EVAL($code, Str :$lang where { ($lang // '') eq 'Perl5' },
2320
PseudoStash :$context)
2421
=end code
2522
26-
If it is invoked as a method, it calls the subroutine form with
27-
invocant as the first argument, C<$code>, passing along named args, if any; this
28-
coerces L<Cool|/type/Cool> C<$code> to L<Str|/type/Str>. If C<$code> is a
29-
L<Blob|/type/Blob>, it'll be processed using the same encoding as the C<$lang>
30-
compiler would: for C<perl6> C<$lang>, uses C<utf-8>; for C<Perl5>, processes
31-
using the same rules as C<perl>.
23+
This routine coerces L<Cool|/type/Cool> C<$code> to L<Str|/type/Str>. If
24+
C<$code> is a L<Blob|/type/Blob>, it'll be processed using the same encoding as
25+
the C<$lang> compiler would: for C<perl6> C<$lang>, uses C<utf-8>; for C<Perl5>,
26+
processes using the same rules as C<perl>.
3227
3328
This works as-is with a literal string parameter. More complex input,
3429
such as a variable or string with embedded code, is illegal by default.

0 commit comments

Comments
 (0)