5 has predicates => (is => 'ro', required => 1);
7 has globals => (is => 'ro', required => 1);
9 has locals => (is => 'ro', required => 1);
11 #has known_facts => (is => 'ro', required => 1);
13 sub lookup_predicate {
14 my ($self, $predicate) = @_;
15 return $self->predicates->{$predicate} || die "No such predicate: $predicate";
19 my ($self, $name) = @_;
20 my $lookup_in = ($name =~ /^[_A-Z]/ ? $self->locals->[-1] : $self->globals);
21 return $lookup_in->get_member_at($name)
22 or die "No such name in scope: $name";
25 sub depth { $#{$_[0]->locals} }
29 $self->but(locals => [ @{$self->locals}[0..$to] ]);
34 if ($at =~ /^[0-9]+$/) {
35 return $self->locals->[$at];
37 return $self->globals->get_member_at($at);
41 my ($self, $at, $value) = @_;
42 if ($at =~ /^[0-9]+$/) {
43 my @locals = @{$self->locals};
44 $locals[$at] = $value;
50 globals => $self->globals->with_member_at($at, $value)