remove the _then bind methods
Matt S Trout [Tue, 11 Feb 2014 07:23:25 +0000 (07:23 +0000)]
lib/DX/Op/MemberOf.pm
lib/DX/State.pm
t/basic.t

index 4493620..e5e9ca4 100644 (file)
@@ -17,8 +17,9 @@ sub run {
   my ($member, $of) = @args{qw(member of)};
   die "member bound" if $member->is_bound;
   my $set = $state->facts->{$of->bound_value};
-  return $state->bind_root_set_then($member->id, $set, $self->next)
-               ->add_dependencies($member->id, $of->id);
+  return $state->then($self->next)
+               ->add_dependencies($member->id, $of->id)
+               ->bind_root_set($member->id, $set)
 }
 
 1;
index 051d0d2..c677ce0 100644 (file)
@@ -67,21 +67,19 @@ sub bind_value {
   );
 }
 
-sub bind_stream_then {
-  my ($self, $var, $stream, $then) = @_;
+sub bind_stream {
+  my ($self, $var, $stream) = @_;
   my $bound = $var->with_stream($stream);
   $self->but(
     by_id => { %{$self->by_id}, $var->id => $bound },
-    next_op => $then
   )->mark_choice($bound);
 }
 
-sub bind_root_set_then {
-  my ($self, $var_id, $set, $then) = @_;
+sub bind_root_set {
+  my ($self, $var_id, $set) = @_;
   my $bound = $self->by_id->{$var_id}->with_root_set($set);
   $self->but(
     by_id => { %{$self->by_id}, $var_id => $bound },
-    next_op => $then
   )->mark_choice($bound);
 }
 
index aba5c58..8612ea7 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -28,10 +28,9 @@ sub bind_array {
   my ($var, $array) = @_;
   sub {
     my ($self, $state) = @_;
-    $state->bind_stream_then(
+    $state->then($self->next)->bind_stream(
       $state->scope_var($var),
       ArrayStream->from_array(@$array),
-      $self->next
     )
   }
 }