[Bps-public-commit] r12655 - in pie/branches/named-params: . doc lib/PIE

jesse at bestpractical.com jesse at bestpractical.com
Sat May 24 00:26:22 EDT 2008


Author: jesse
Date: Sat May 24 00:26:20 2008
New Revision: 12655

Modified:
   pie/branches/named-params/TODO
   pie/branches/named-params/doc/yapperl.txt
   pie/branches/named-params/lib/PIE/Evaluator.pm
   pie/branches/named-params/lib/PIE/Expression.pm
   pie/branches/named-params/t/01basic.t
   pie/branches/named-params/t/hello_world.t
   pie/branches/named-params/t/leaky-lexicals.t
   pie/branches/named-params/t/named-params.t

Log:
* global symbol table renamed

Modified: pie/branches/named-params/TODO
==============================================================================
--- pie/branches/named-params/TODO	(original)
+++ pie/branches/named-params/TODO	Sat May 24 00:26:20 2008
@@ -1,10 +1,10 @@
 Backend
 
-# is there a reason we shouldn't force _all_ arguments to _all_ functions to be named? 
+# is there a reason we shouldn't force _all_ arguments to _all_ functions to be global_symbols? 
 
-- define named functions with typed arguments
+- define global_symbols functions with typed arguments
   - builtins
-    - control op: named subexpression?
+    - control op: global_symbols subexpression?
     - 
 
 
@@ -15,7 +15,7 @@
   args => { value => 'defined-symbol' } }
   
 { op => 'orz',
-  args => { named1 => EXP2,
+  args => { global_symbols1 => EXP2,
             orz2   => EXP3 } }
 
 
@@ -60,7 +60,7 @@
 - let user add an expression as an argument to an existing expression
 - let user add expression to run sequentially "after" another expression
 - serialize and save the tree of expressions 
-- save a tree of expressions as a named thingy which can be referenced from other expressions.
+- save a tree of expressions as a global_symbols thingy which can be referenced from other expressions.
 
 Hooks
 

Modified: pie/branches/named-params/doc/yapperl.txt
==============================================================================
--- pie/branches/named-params/doc/yapperl.txt	(original)
+++ pie/branches/named-params/doc/yapperl.txt	Sat May 24 00:26:20 2008
@@ -63,7 +63,7 @@
         does it return results or does it shove results in some input handed to it?
         
 
-    a block is essentially a named bricks built up of one or more blocks or bricks
+    a block is essentially a global_symbols bricks built up of one or more blocks or bricks
     
     
 
@@ -300,7 +300,7 @@
 # a class to describe an op tree
 # a class to run an optree
 # primitives for basic ops
-    # run a named optree like it's a primitive
+    # run a global_symbols optree like it's a primitive
     
 # primitives for variables
 # a way to store an optree as a variable

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	Sat May 24 00:26:20 2008
@@ -11,14 +11,14 @@
     default => sub { return PIE::EvaluatorResult->new()}
     );
     
-has named => (
+has global_symbols => (
              metaclass => 'Collection::Hash',
              is        => 'rw',
              default   => sub { {} },
              isa => 'HashRef',
              provides  => {
-                 get       => 'get_named',
-                 set       => 'set_named',
+                 get       => 'get_global_symbol',
+                 set       => 'set_global_symbol',
              });
 
 has stack_vars => (
@@ -82,11 +82,11 @@
 sub trace{}
 
 
-sub resolve_name {
+sub resolve_symbol_name {
     my ($self, $name) = @_;
     my $stack = $self->stack_vars->[-1] || {};
     Carp::cluck if ref($name);
-    $stack->{$name} || $self->get_named($name) || die "Could not find symbol $name in the current lexical context.";
+    $stack->{$name} || $self->get_global_symbol($name) || die "Could not find symbol $name in the current lexical context.";
 }
 
 sub apply_script {

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	Sat May 24 00:26:20 2008
@@ -32,7 +32,7 @@
 
 sub evaluate {
     my ($self, $ev) = @_;
-    my $lambda = $ev->resolve_name($self->name);
+    my $lambda = $ev->resolve_symbol_name($self->name);
     die "Function ".$self->name." not defined"  unless $lambda;
     $ev->apply_script( $lambda, $self->args );
     return $ev->result->value;
@@ -151,7 +151,7 @@
 sub evaluate {
     my ($self, $eval) = validate_pos(@_, { isa => 'PIE::Expression'}, { isa => 'PIE::Evaluator'});
     my $symbol = $self->{'args'}->{'symbol'}->evaluate($eval);
-    my $result = $eval->resolve_name($symbol);
+    my $result = $eval->resolve_symbol_name($symbol);
     return $result->meta->does_role('PIE::Evaluatable') ? $result->evaluate($eval): $result; # XXX: figure out evaluation order here
 }
 

Modified: pie/branches/named-params/t/01basic.t
==============================================================================
--- pie/branches/named-params/t/01basic.t	(original)
+++ pie/branches/named-params/t/01basic.t	Sat May 24 00:26:20 2008
@@ -78,7 +78,7 @@
 
 );
 
-$eval9->set_named( 'match-regexp' => $MATCH_REGEX );
+$eval9->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
 
 $eval9->apply_script(
     $MATCH_REGEX, 
@@ -92,7 +92,7 @@
 
 my $builder = PIE::Builder->new();
 my $eval10 = PIE::Evaluator->new();
-$eval10->set_named( 'match-regexp' => $MATCH_REGEX );
+$eval10->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
 
 $eval10->apply_script(
     $builder->defun(

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	Sat May 24 00:26:20 2008
@@ -51,12 +51,12 @@
 isa_ok( $hello => 'Hello' );
 
 use PIE::Lambda::Native;
-$hello->evaluator->set_named( 'make-fred',
+$hello->evaluator->set_global_symbol( 'make-fred',
     PIE::Lambda::Native->new( body => sub { return 'fred' } ) );
-$hello->evaluator->set_named( 'make-bob',
+$hello->evaluator->set_global_symbol( 'make-bob',
     PIE::Lambda::Native->new( body => sub { return 'bob' } ) );
 
-$hello->evaluator->set_named(
+$hello->evaluator->set_global_symbol(
     'make-whoever',
     PIE::Lambda::Native->new(
         body => sub { my $args = shift; return $args->{'name'} },
@@ -106,7 +106,7 @@
 isa_ok( $hello->rules->[1], 'PIE::Lambda' );
 is( $hello->run('jesse'), 'Hello fred' );
 
-$hello->rules( [ $hello->evaluator->get_named('make-whoever') ] );
+$hello->rules( [ $hello->evaluator->get_global_symbol('make-whoever') ] );
 isa_ok( $hello->rules->[0], 'PIE::Lambda' );
 is( $hello->run('jesse'), 'Hello jesse' );
 

Modified: pie/branches/named-params/t/leaky-lexicals.t
==============================================================================
--- pie/branches/named-params/t/leaky-lexicals.t	(original)
+++ pie/branches/named-params/t/leaky-lexicals.t	Sat May 24 00:26:20 2008
@@ -22,7 +22,7 @@
         signature => { x => PIE::FunctionArgument->new(name => 'x', type => 'Str')});
 
 
-$eval->set_named( 'a' => $A_SIDE );
+$eval->set_global_symbol( 'a' => $A_SIDE );
 
 my $defined_b = $builder->defun(
     ops => [{ name => 'a', args => { x => 'x456' }} ],
@@ -30,7 +30,7 @@
         { y => PIE::FunctionArgument->new( name => 'y', type => 'String' ) }
 );
 
-$eval->set_named( b=> $defined_b);
+$eval->set_global_symbol( b=> $defined_b);
 
 $eval->run( $builder->build_expression( { name => 'b', args => { y => 'Y123' }}));
 ok (!$eval->result->success);

Modified: pie/branches/named-params/t/named-params.t
==============================================================================
--- pie/branches/named-params/t/named-params.t	(original)
+++ pie/branches/named-params/t/named-params.t	Sat May 24 00:26:20 2008
@@ -23,7 +23,7 @@
 
 );
 my $eval5 = PIE::Evaluator->new;
-$eval5->set_named( 'match-regex' => $MATCH_REGEX );
+$eval5->set_global_symbol( 'match-regex' => $MATCH_REGEX );
 
 my $match_p = PIE::Expression->new(
         name => 'match-regex',
@@ -40,7 +40,7 @@
 
 my $eval6 = PIE::Evaluator->new();
 
-$eval6->set_named( 'match-regex' => $MATCH_REGEX );
+$eval6->set_global_symbol( 'match-regex' => $MATCH_REGEX );
 
 my $match_fail_p = PIE::Expression->new(
         name => 'match-regex',



More information about the Bps-public-commit mailing list