[Bps-public-commit] r12673 - pie/branches/named-params/lib/PIE
clkao at bestpractical.com
clkao at bestpractical.com
Sun May 25 00:54:14 EDT 2008
Author: clkao
Date: Sun May 25 00:54:13 2008
New Revision: 12673
Modified:
pie/branches/named-params/lib/PIE/Builder.pm
pie/branches/named-params/lib/PIE/Expression.pm
Log:
make signatures class-attributes for primitive expressions.
Modified: pie/branches/named-params/lib/PIE/Builder.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Builder.pm (original)
+++ pie/branches/named-params/lib/PIE/Builder.pm Sun May 25 00:54:13 2008
@@ -13,6 +13,9 @@
$class->require;
$class = "PIE::Expression" unless $class->can('meta');
+ # XXX: in case of primitive-ops, we should only bulid the args we
+ # know about
+
return $class->new( name => $name, args => { map { $_ => $self->build_expression( $args->{$_} ) } keys %$args } );
}
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 00:54:13 2008
@@ -23,14 +23,6 @@
default => sub { {} },
isa => 'HashRef[PIE::Expression]');
-#Attribute (args) does not pass the type constraint because: Validation failed for 'HashRef[PIE::FunctionArgument]' failed with value HASH(0x9a979c) at /opt/local/lib/perl5/site_perl/5.8.8/Moose/Meta/Attribute.pm line 340
-
-# (foo bar (orz 1 ))
-# === (eval 'foo bar (orz 1))
-# === (apply foo ((bar (orz 1))
-
-
-
sub evaluate {
my ($self, $ev) = @_;
my $lambda = $ev->resolve_symbol_name($self->name);
@@ -54,12 +46,14 @@
return ! $self->SUPER::evaluate();
}
+
package PIE::Expression::IfThen;
use Moose;
extends 'PIE::Expression';
use Params::Validate qw/validate_pos/;
+use MooseX::ClassAttribute;
-has signature => (
+class_has signature => (
is => 'ro',
default => sub {
{
@@ -93,8 +87,9 @@
use Moose;
extends 'PIE::Expression';
use Params::Validate qw/validate_pos/;
+use MooseX::ClassAttribute;
-has signature => (
+class_has signature => (
is => 'ro',
default => sub {
{ value => PIE::FunctionArgument->new( name => 'value', type => 'Str' )
@@ -143,8 +138,9 @@
use Moose;
extends 'PIE::Expression';
use Params::Validate qw/validate_pos/;
+use MooseX::ClassAttribute;
-has signature => (
+class_has signature => (
is => 'ro',
default => sub { { symbol => PIE::FunctionArgument->new( name => 'symbol', type => 'Str')}});
@@ -156,5 +152,7 @@
return $result->meta->does_role('PIE::Evaluatable') ? $result->evaluate($eval): $result; # XXX: figure out evaluation order here
}
+package PIE::Expression::Let;
+
1;
More information about the Bps-public-commit
mailing list