[Bps-public-commit] r12680 - pie/branches/named-params/lib/PIE

clkao at bestpractical.com clkao at bestpractical.com
Sun May 25 06:44:12 EDT 2008


Author: clkao
Date: Sun May 25 06:43:54 2008
New Revision: 12680

Modified:
   pie/branches/named-params/lib/PIE/Expression.pm

Log:
move let's lambda into lazy accessor builder.


Modified: pie/branches/named-params/lib/PIE/Expression.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Expression.pm	(original)
+++ pie/branches/named-params/lib/PIE/Expression.pm	Sun May 25 06:43:54 2008
@@ -30,7 +30,6 @@
     return $ev->result->value;
 }
 
-
 package PIE::Expression::True;
 use Moose;
 use MooseX::ClassAttribute;
@@ -177,6 +176,21 @@
     default => sub { { } },
 );
 
+has lambda => (
+    is => 'ro',
+    isa => 'PIE::Lambda',
+    lazy => 1,
+    default => sub {
+        my $self = shift;
+        PIE::Lambda->new(
+            progn     => PIE::Expression::ProgN->new( nodes => $self->nodes ),
+            signature => $self->mk_signature,
+            block_id => $self->block_id,
+            outter_scope => $self->outter_scope,
+        );
+    },
+);
+
 sub BUILD {
     my ($self, $params) = @_;
 
@@ -195,12 +209,7 @@
 
 sub evaluate {
     my ($self, $evaluator) = @_;
-    $evaluator->apply_script(
-        PIE::Lambda->new(
-            progn     => PIE::Expression::ProgN->new( nodes => $self->nodes ),
-            signature => $self->mk_signature,
-        ),
-        $self->bindings );
+    $evaluator->apply_script( $self->lambda, $self->bindings );
 
 }
 



More information about the Bps-public-commit mailing list