On Wed, 09 Jul 2014 07:10:31 -0700, coke wrote:
> S29 says that EVAL should work on Buf in addition to Str; There is one
> test in S29-context/eval.t that tests for this but is skipped.
> 
> Could probably use more tests.
> 

Everything is now implemented[^1] with more tests added[^2], and I unfudged[^3] 
one
of the two pre-existing tests. However, the remaining one tests for existence
of Blob.EVAL **method**.

Feels like it shouldn't be added at all. I heard people in the past express
desire to remove Str.EVAL, especially because it (currently) by-passes[^4]
the MONKEY restriction. It's a security-sensitive part of machinery and
doesn't feel right to add many places where it's available; especially
since subform can even by called as a method via `.&EVAL`; so why add
an explicit method?

Personally, I'd toss that fudge and not implement the method, but leaving
this ticket open as RFC for now. Below is also a diff that adds the EVAL
method to Blob.

[1] https://github.com/rakudo/rakudo/commit/6c928d61d9
[2] https://github.com/perl6/roast/commit/6949cb13ad
[3] https://github.com/perl6/roast/commit/60f4bd7850
[4] https://rt.perl.org/Ticket/Display.html?id=128684#ticket-history


diff --git a/src/core/Buf.pm b/src/core/Buf.pm
index eca050e..faf7ead 100644
--- a/src/core/Buf.pm
+++ b/src/core/Buf.pm
@@ -101,6 +101,10 @@ my role Blob[::T = uint8] does Positional[T] does Stringy 
is repr('VMArray') is
         )
     }
 
+    method EVAL(*%opts) {
+        EVAL(self, context => CALLER::, |%opts);
+    }
+
     multi method Bool(Blob:D:) { nqp::p6bool(nqp::elems(self)) }
 
     multi method elems(Blob:D:)   { nqp::p6box_i(nqp::elems(self)) }

Reply via email to