From 48a8de321378f4c9447831bdc691615096473f0d Mon Sep 17 00:00:00 2001 From: Tobias Leich Date: Wed, 1 Jan 2014 22:50:03 +0100 Subject: [PATCH] rename sub and method `eval` to `EVAL` --- docs/making-standalone-exes.txt | 2 +- examples/perl5.pl | 14 +++++++------- lib/Builtins.cs | 4 ++-- lib/CORE.setting | 4 ++-- lib/Niecza/Benchmark.pm6 | 2 +- lib/Test.pm6 | 8 ++++---- perf/JsonTinyViv.pl6 | 2 +- perl5/Niecza/lib/Niecza.pm | 2 +- src/NieczaActions.pm6 | 2 +- src/NieczaBackendDotnet.pm6 | 4 ++-- src/OpHelpers.pm6 | 4 ++-- src/Operator.pm6 | 2 +- t/p5/create_LoS.t | 2 +- test2.pl | 2 +- test3.pl | 16 ++++++++-------- 15 files changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/making-standalone-exes.txt b/docs/making-standalone-exes.txt index faf79a15..00208ba4 100644 --- a/docs/making-standalone-exes.txt +++ b/docs/making-standalone-exes.txt @@ -19,7 +19,7 @@ have at least one dll. =item * -It is not possible to use C or similar functionality with a precompiled +It is not possible to use C or similar functionality with a precompiled program. =head1 METHOD diff --git a/examples/perl5.pl b/examples/perl5.pl index 27f386fb..36cdcc90 100644 --- a/examples/perl5.pl +++ b/examples/perl5.pl @@ -1,11 +1,11 @@ -eval(q:to/PERL5/,:lang); +EVAL(q:to/PERL5/,:lang); print "Hel"."lo "; PERL5 -eval(q:to/PERL5/,:lang); +EVAL(q:to/PERL5/,:lang); print "World\n"; PERL5 -eval(q:to/PERL5/,:lang); +EVAL(q:to/PERL5/,:lang); use strict; use warnings; package Foo; @@ -18,9 +18,9 @@ sub new { bless {},"Foo"; } PERL5 -my $foo = eval(:lang,'Foo->new'); +my $foo = EVAL(:lang,'Foo->new'); say $foo.baz("Perl hacker"); -say eval(:lang,"125"); -say eval(:lang,"13.5"); -say eval(:lang,"'Hello there'"); +say EVAL(:lang,"125"); +say EVAL(:lang,"13.5"); +say EVAL(:lang,"'Hello there'"); diff --git a/lib/Builtins.cs b/lib/Builtins.cs index ae642f11..1fc0a6f2 100644 --- a/lib/Builtins.cs +++ b/lib/Builtins.cs @@ -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) @@ -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) diff --git a/lib/CORE.setting b/lib/CORE.setting index 43e1fb95..9beaf125 100644 --- a/lib/CORE.setting +++ b/lib/CORE.setting @@ -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); @@ -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 { diff --git a/lib/Niecza/Benchmark.pm6 b/lib/Niecza/Benchmark.pm6 index 6b34e88b..642f09e5 100644 --- a/lib/Niecza/Benchmark.pm6 +++ b/lib/Niecza/Benchmark.pm6 @@ -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) } diff --git a/lib/Test.pm6 b/lib/Test.pm6 index c0e3ee9d..18ebbc64 100755 --- a/lib/Test.pm6 +++ b/lib/Test.pm6 @@ -138,16 +138,16 @@ sub fails_ok($code,$why?,:$expect = ) 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 = ) 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 { diff --git a/perf/JsonTinyViv.pl6 b/perf/JsonTinyViv.pl6 index b43a6bde..7c8e2e77 100644 --- a/perf/JsonTinyViv.pl6 +++ b/perf/JsonTinyViv.pl6 @@ -41,6 +41,6 @@ grammar JSONGrammar { } } -JSONGrammar.parse(eval 'local $/; ') +JSONGrammar.parse(EVAL 'local $/; ') # vim: ft=perl6 diff --git a/perl5/Niecza/lib/Niecza.pm b/perl5/Niecza/lib/Niecza.pm index 3aa3d40d..239e2f0a 100644 --- a/perl5/Niecza/lib/Niecza.pm +++ b/perl5/Niecza/lib/Niecza.pm @@ -24,7 +24,7 @@ use Niecza::Object; =head1 SYNOPSIS use v6; -eval(:lang,"..."); +EVAL(:lang,"..."); =head1 AUTHOR diff --git a/src/NieczaActions.pm6 b/src/NieczaActions.pm6 index e87c594d..f7d7967f 100644 --- a/src/NieczaActions.pm6 +++ b/src/NieczaActions.pm6 @@ -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); diff --git a/src/NieczaBackendDotnet.pm6 b/src/NieczaBackendDotnet.pm6 index 37c63c5f..580e6489 100644 --- a/src/NieczaBackendDotnet.pm6 +++ b/src/NieczaBackendDotnet.pm6 @@ -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])); } diff --git a/src/OpHelpers.pm6 b/src/OpHelpers.pm6 index d80a597e..92ab61ef 100644 --- a/src/OpHelpers.pm6 +++ b/src/OpHelpers.pm6 @@ -17,14 +17,14 @@ sub mklet($value, $body) is export { sub mkcall($/, $name, *@positionals) is export { $/.CURSOR.mark_used($name); - $*CURLEX.noninlinable if $name eq '&eval'; # HACK + $*CURLEX.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.noninlinable if $name eq '&eval'; # HACK + $*CURLEX.noninlinable if $name eq '&EVAL'; # HACK $OpLexical.new(pos=>$/, :$name, |%_); } diff --git a/src/Operator.pm6 b/src/Operator.pm6 index f1aa5237..fb1d1cde 100644 --- a/src/Operator.pm6 +++ b/src/Operator.pm6 @@ -118,7 +118,7 @@ class Method is Operator { $OpInterrogative.new(pos=>$/, receiver => @args[0], name => $.name); } else { - $*CURLEX.noninlinable if $!name eq 'eval'; + $*CURLEX.noninlinable if $!name eq 'EVAL'; my $pclass; if $.private { if $.package { diff --git a/t/p5/create_LoS.t b/t/p5/create_LoS.t index 6e046933..351a12ff 100644 --- a/t/p5/create_LoS.t +++ b/t/p5/create_LoS.t @@ -1,6 +1,6 @@ use v6; use Test; -my $LoS = eval(:lang,q:to/PERL5/); +my $LoS = EVAL(:lang,q:to/PERL5/); use Data::Dumper; my $LoS = Niecza::create_LoS(["foo1","bar1","baz1"]); $LoS; diff --git a/test2.pl b/test2.pl index 1c08765f..d45c5b82 100644 --- a/test2.pl +++ b/test2.pl @@ -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; } { diff --git a/test3.pl b/test3.pl index 849285d5..879cebbb 100644 --- a/test3.pl +++ b/test3.pl @@ -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)';