Skip to content

Commit

Permalink
rename sub and method eval to EVAL
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Jan 1, 2014
1 parent 17d73e4 commit 48a8de3
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/making-standalone-exes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ have at least one dll.

=item *

It is not possible to use C<eval> or similar functionality with a precompiled
It is not possible to use C<EVAL> or similar functionality with a precompiled
program.

=head1 METHOD
Expand Down
14 changes: 7 additions & 7 deletions examples/perl5.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
eval(q:to/PERL5/,:lang<perl5>);
EVAL(q:to/PERL5/,:lang<perl5>);
print "Hel"."lo ";
PERL5
eval(q:to/PERL5/,:lang<perl5>);
EVAL(q:to/PERL5/,:lang<perl5>);
print "World\n";
PERL5

eval(q:to/PERL5/,:lang<perl5>);
EVAL(q:to/PERL5/,:lang<perl5>);
use strict;
use warnings;
package Foo;
Expand All @@ -18,9 +18,9 @@ sub new {
bless {},"Foo";
}
PERL5
my $foo = eval(:lang<perl5>,'Foo->new');
my $foo = EVAL(:lang<perl5>,'Foo->new');
say $foo.baz("Perl hacker");
say eval(:lang<perl5>,"125");
say eval(:lang<perl5>,"13.5");
say eval(:lang<perl5>,"'Hello there'");
say EVAL(:lang<perl5>,"125");
say EVAL(:lang<perl5>,"13.5");
say EVAL(:lang<perl5>,"'Hello there'");

4 changes: 2 additions & 2 deletions lib/Builtins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ public static Frame simple_eval(Frame th, Variable str) {
if (th.info.setting.upcall_receiver == null)
return Kernel.Die(th, "Cannot eval; no compiler available");
SubInfo outer = th.caller.info;
object r = UpCall(th.info.setting, "eval",
object r = UpCall(th.info.setting, "EVAL",
str.Fetch().mo.mro_raw_Str.Get(str),
new Niecza.CLRBackend.Handle(outer),
new Niecza.CLRBackend.Handle(th.caller)
Expand All @@ -2100,7 +2100,7 @@ internal static P6any compile_bind_regex(Frame th, string code) {
if (!th.info.rx_compile_cache.TryGetValue(code, out main)) {
if (th.info.setting.upcall_receiver == null)
throw new NieczaException("Cannot eval; no compiler available");
object r = UpCall(th.info.setting, "eval",
object r = UpCall(th.info.setting, "EVAL",
"regex {" + code + "}",
new Niecza.CLRBackend.Handle(th.info));
if (r is Exception)
Expand Down
4 changes: 2 additions & 2 deletions lib/CORE.setting
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ my class Cool {
method trim-leading () { self.subst(/^ \s+/, "") }
method trim-trailing() { self.subst(/\s+ $/, "") }
method trim () { self.trim-leading.trim-trailing }
method eval() { eval(~self) }
method EVAL() { EVAL(~self) }
method fmt(Str $format = '%s') {
sprintf($format, self);
Expand Down Expand Up @@ -3573,7 +3573,7 @@ sub infix:« ==>> »(\|$args) { die "Feed ops NYI" } #OK
sub infix<== »(\|$args) { die "Feed ops NYI" } #OK
sub infix<<== »(\|$args) { die "Feed ops NYI" } #OK
sub eval($str,:$lang="perl6") is return-pass {
sub EVAL($str,:$lang="perl6") is return-pass {
if $lang eq "perl6" {
Q:CgOp { (simple_eval {$str}) }
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/Niecza/Benchmark.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ my ($prologue, $baseline);
sub mktimer($code is copy) {
$code = "$code ;" x 20;
$code = '\qq[$prologue]; sub ($__j is copy) { my $__i = times[0]; (\qq[$code]) while --$__j; times[0] - $__i } #OK';
eval $code;
EVAL $code;
}

sub fnum($n) { $n ~~ /:i e/ ?? $n !! substr($n,0,6) }
Expand Down
8 changes: 4 additions & 4 deletions lib/Test.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ sub fails_ok($code,$why?,:$expect = <die warn fail>) is export {
$*TEST-BUILDER.ok(?(no-control($code) eq any(@$expect)), $why);
}
sub eval_lives_ok($code,$why?) is export {
$*TEST-BUILDER.ok(no-control({ eval $code }, :diag) ne "die", $why);
$*TEST-BUILDER.ok(no-control({ EVAL $code }, :diag) ne "die", $why);
}
sub eval_dies_ok($code,$why?) is export {
$*TEST-BUILDER.ok(no-control({ eval $code }) eq "die", $why);
$*TEST-BUILDER.ok(no-control({ EVAL $code }) eq "die", $why);
}
sub eval_succeeds_ok($code,$why?,:$ignore = ()) is export {
$*TEST-BUILDER.ok(?(no-control({ eval $code }) eq any("", @$ignore)), $why);
$*TEST-BUILDER.ok(?(no-control({ EVAL $code }) eq any("", @$ignore)), $why);
}
sub eval_fails_ok($code,$why?,:$expect = <die warn fail>) is export {
$*TEST-BUILDER.ok(?(no-control({ eval $code }) eq any(@$expect)), $why);
$*TEST-BUILDER.ok(?(no-control({ EVAL $code }) eq any(@$expect)), $why);
}
sub diag($str) is export { $*TEST-BUILDER.note($str) }
sub is_approx(Mu $got, Mu $expected, $desc = '') is export {
Expand Down
2 changes: 1 addition & 1 deletion perf/JsonTinyViv.pl6
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ grammar JSONGrammar {
}
}

JSONGrammar.parse(eval 'local $/; <STDIN>')
JSONGrammar.parse(EVAL 'local $/; <STDIN>')

# vim: ft=perl6
2 changes: 1 addition & 1 deletion perl5/Niecza/lib/Niecza.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use Niecza::Object;
=head1 SYNOPSIS
use v6;
eval(:lang<perl5>,"...");
EVAL(:lang<perl5>,"...");

=head1 AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion src/NieczaActions.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -3565,7 +3565,7 @@ method use_from_perl5($/,$name) {
class => 'Code');

my $p5code = '\\&'~$func;
my $p5sub = $OpCallSub.new(pos=>$/,invocant=>mklex($/,'&eval'),args=>[$OpStringLiteral.new(text=>$p5code),$OpSimplePair.new(key=>'lang',value=>$OpStringLiteral.new(text=>'perl5'))]);
my $p5sub = $OpCallSub.new(pos=>$/,invocant=>mklex($/,'&EVAL'),args=>[$OpStringLiteral.new(text=>$p5code),$OpSimplePair.new(key=>'lang',value=>$OpStringLiteral.new(text=>'perl5'))]);
$placeholder.add_my_name('|capture');
my $sig = $Sig.new(params => [$SigParameter.new(flags=>$Sig::SLURPY_CAP,name=>'|capture',slot=>'|capture')]);
$placeholder.set_signature($sig);
Expand Down
4 changes: 2 additions & 2 deletions src/NieczaBackendDotnet.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ sub locstr($fo, $lo, $fn, $ln) {
sub upcalled(*@args) {
my $v = $*compiler.verbose;
given @args[0] {
when "eval" {
when "EVAL" {
my $*IN_EVAL = True;
say "eval: @args[1] from @args[2].name()" if $v;
say "EVAL: @args[1] from @args[2].name()" if $v;
return $*compiler.compile_string(@args[1], True, :evalmode,
:outer(@args[2]), :outer_frame(@args[3]));
}
Expand Down
4 changes: 2 additions & 2 deletions src/OpHelpers.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ sub mklet($value, $body) is export {

sub mkcall($/, $name, *@positionals) is export {
$/.CURSOR.mark_used($name);
$*CURLEX<!sub>.noninlinable if $name eq '&eval'; # HACK
$*CURLEX<!sub>.noninlinable if $name eq '&EVAL'; # HACK
$OpCallSub.new(pos=>$/,
invocant => $OpLexical.new(pos=>$/, :$name), :@positionals);
}

sub mklex($/, $name, *%_) is export {
$/.CURSOR.mark_used($name);
$*CURLEX<!sub>.noninlinable if $name eq '&eval'; # HACK
$*CURLEX<!sub>.noninlinable if $name eq '&EVAL'; # HACK
$OpLexical.new(pos=>$/, :$name, |%_);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Operator.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Method is Operator {
$OpInterrogative.new(pos=>$/, receiver => @args[0],
name => $.name);
} else {
$*CURLEX<!sub>.noninlinable if $!name eq 'eval';
$*CURLEX<!sub>.noninlinable if $!name eq 'EVAL';
my $pclass;
if $.private {
if $.package {
Expand Down
2 changes: 1 addition & 1 deletion t/p5/create_LoS.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use v6;
use Test;
my $LoS = eval(:lang<perl5>,q:to/PERL5/);
my $LoS = EVAL(:lang<perl5>,q:to/PERL5/);
use Data::Dumper;
my $LoS = Niecza::create_LoS(["foo1","bar1","baz1"]);
$LoS;
Expand Down
2 changes: 1 addition & 1 deletion test2.pl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
push @frags, "is ckb(1 @$lt 2 @$gt 3), $right_br_ord, '$msg (1)';\n";
push @frags, "is ckb(1 @$gt 2 @$lt 3), $right_br_opp, '$msg (2)';\n";
}
eval @frags.join;
EVAL @frags.join;
}

{
Expand Down
16 changes: 8 additions & 8 deletions test3.pl
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@
multi qux(Any:U $) { "U" }
multi qux(Any:D $) { "D" }

lives_ok { eval "foo(Int)" }, ":U allows type objects";
dies_ok { eval "foo(5)" }, ":U denies concrete objects";
lives_ok { EVAL "foo(Int)" }, ":U allows type objects";
dies_ok { EVAL "foo(5)" }, ":U denies concrete objects";

lives_ok { eval "bar(5)" }, ":D allows concrete objects";
dies_ok { eval "bar(Int)" }, ":D denies type objects";
lives_ok { EVAL "bar(5)" }, ":D allows concrete objects";
dies_ok { EVAL "bar(Int)" }, ":D denies type objects";

lives_ok { eval "moo(5)" }, ":_ allows concrete objects";
lives_ok { eval "moo(Int)" }, ":_ allows type objects";
lives_ok { EVAL "moo(5)" }, ":_ allows concrete objects";
lives_ok { EVAL "moo(Int)" }, ":_ allows type objects";

lives_ok { eval "cow(Int)" }, ":T allows type objects";
dies_ok { eval "cow(5)" }, ":T denies concrete objects";
lives_ok { EVAL "cow(Int)" }, ":T allows type objects";
dies_ok { EVAL "cow(5)" }, ":T denies concrete objects";

is qux(Int), 'U', 'multi can discriminate on :U/:D (1)';
is qux(5), 'D', 'multi can discriminate on :U/:D (2)';
Expand Down

0 comments on commit 48a8de3

Please sign in to comment.