Skip to content
Permalink
Browse files

Moves EVAL as method back to Cool

Also eliminates implementation details from EVAL. Closes #2822
  • Loading branch information...
JJ committed May 22, 2019
1 parent 94ff45f commit 649b9e9c73de7902e1e85a05aee4cd96672e72a2
Showing with 16 additions and 10 deletions.
  1. +11 −0 doc/Type/Cool.pod6
  2. +5 −10 doc/Type/independent-routines.pod6
@@ -142,6 +142,17 @@ imaginary part negated).
say (1+2i).conj; # OUTPUT: «1-2i␤»
=head2 routine EVAL
Defined as:
=for code :method
method EVAL(*%_)
It calls the L<subroutine form|/type/independent-routines#sub_mkdir> with the
invocant as the first argument, C<$code>, passing along named args, if any.
=head2 routine sqrt
Defined as:
@@ -12,23 +12,18 @@ actually attached to any particular class or role.
Defined as:
=begin code :method
method EVAL(*%_)
=end code
=begin code :method
proto sub EVAL($code is copy where Blob|Cool|Callable, Str() :$lang = 'perl6',
proto sub EVAL($code where Blob|Cool|Callable, Str() :$lang = 'perl6',
PseudoStash :$context, *%n)
=end code
=begin code :method
multi sub EVAL($code, Str :$lang where { ($lang // '') eq 'Perl5' },
PseudoStash :$context)
=end code
If it is invoked as a method, it calls the subroutine form with
invocant as the first argument, C<$code>, passing along named args, if any; this
coerces L<Cool|/type/Cool> C<$code> to L<Str|/type/Str>. If C<$code> is a
L<Blob|/type/Blob>, it'll be processed using the same encoding as the C<$lang>
compiler would: for C<perl6> C<$lang>, uses C<utf-8>; for C<Perl5>, processes
using the same rules as C<perl>.
This routine coerces L<Cool|/type/Cool> C<$code> to L<Str|/type/Str>. If
C<$code> is a L<Blob|/type/Blob>, it'll be processed using the same encoding as
the C<$lang> compiler would: for C<perl6> C<$lang>, uses C<utf-8>; for C<Perl5>,
processes using the same rules as C<perl>.
This works as-is with a literal string parameter. More complex input,
such as a variable or string with embedded code, is illegal by default.

0 comments on commit 649b9e9

Please sign in to comment.
You can’t perform that action at this time.