[Bps-public-commit] r12651 - in pie/branches/named-params: lib/PIE t
clkao at bestpractical.com
clkao at bestpractical.com
Fri May 23 21:00:47 EDT 2008
Author: clkao
Date: Fri May 23 21:00:44 2008
New Revision: 12651
Modified:
pie/branches/named-params/lib/PIE/Evaluator.pm
pie/branches/named-params/lib/PIE/Lambda.pm
pie/branches/named-params/lib/PIE/Lambda/Native.pm
pie/branches/named-params/t/hello_world.t
Log:
PIE::Lambda is not an evaluatable, the base-class expression is.
Modified: pie/branches/named-params/lib/PIE/Evaluator.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Evaluator.pm (original)
+++ pie/branches/named-params/lib/PIE/Evaluator.pm Fri May 23 21:00:44 2008
@@ -96,7 +96,7 @@
);
Carp::confess unless($lambda);
- my $ret = $lambda->evaluate( $self => $args);
+ my $ret = $lambda->apply( $self => $args);
$self->result->value($ret);
$self->result->success(1);
}
Modified: pie/branches/named-params/lib/PIE/Lambda.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Lambda.pm (original)
+++ pie/branches/named-params/lib/PIE/Lambda.pm Fri May 23 21:00:44 2008
@@ -1,7 +1,6 @@
package PIE::Lambda;
use Moose; use MooseX::Params::Validate;
-with 'PIE::Evaluatable';
has nodes => (
is => 'rw',
@@ -12,12 +11,6 @@
is => 'rw',
isa => 'HashRef[PIE::FunctionArgument]');
-has args => (
- is => 'rw',
- default => sub { {} },
- isa => 'HashRef[PIE::Expression]');
-
-
sub check_args {
my $self = shift;
my $passed = shift; #reference to hash of provided args
@@ -56,7 +49,7 @@
}
}
-sub evaluate {
+sub apply {
my ($self, $evaluator, $args) = @_;
Modified: pie/branches/named-params/lib/PIE/Lambda/Native.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Lambda/Native.pm (original)
+++ pie/branches/named-params/lib/PIE/Lambda/Native.pm Fri May 23 21:00:44 2008
@@ -12,7 +12,7 @@
-sub evaluate {
+sub apply {
my ( $self, $evaluator, $args ) = @_;
$self->validate_args_or_die($args);
Modified: pie/branches/named-params/t/hello_world.t
==============================================================================
--- pie/branches/named-params/t/hello_world.t (original)
+++ pie/branches/named-params/t/hello_world.t Fri May 23 21:00:44 2008
@@ -76,7 +76,7 @@
);
$hello->rules( [$script] );
-can_ok( $hello->rules->[0], 'evaluate' );
+isa_ok( $hello->rules->[0], 'PIE::Lambda' );
is( $hello->run('jesse'), 'Hello fred' );
my $script2 = $builder->defun(
@@ -85,7 +85,7 @@
{ name => PIE::FunctionArgument->new( name => 'name', type => 'Str' ) }
);
$hello->rules( [$script2] );
-can_ok( $hello->rules->[0], 'evaluate' );
+isa_ok( $hello->rules->[0], 'PIE::Lambda' );
is( $hello->run('jesse'), 'Hello fred' );
@@ -102,12 +102,12 @@
$hello->rules( [ $script3, $script4 ] );
-can_ok( $hello->rules->[0], 'evaluate' );
-can_ok( $hello->rules->[1], 'evaluate' );
+isa_ok( $hello->rules->[0], 'PIE::Lambda' );
+isa_ok( $hello->rules->[1], 'PIE::Lambda' );
is( $hello->run('jesse'), 'Hello fred' );
$hello->rules( [ $hello->evaluator->get_named('make-whoever') ] );
-can_ok( $hello->rules->[0], 'evaluate' );
+isa_ok( $hello->rules->[0], 'PIE::Lambda' );
is( $hello->run('jesse'), 'Hello jesse' );
1;
More information about the Bps-public-commit
mailing list