26
|
77 |
3 |
0 |
$cache{$frame_class} //= do {
my $current_frame = $frame_class->new;
my $restore_context_wizard = Variable::Magic::wizard('free', sub {
$current_frame = $current_frame->parent;
1;
}
);
my $frame = sub (&) {
&Variable::Magic::cast(\my $guard, $restore_context_wizard);
$current_frame = $current_frame->new;
$_[0]->();
}
;
+{'contrive', sub {
$current_frame->contrive(@_);
}
, 'current_frame', sub {
$current_frame;
}
, 'deduce', sub {
$current_frame->deduce(@_);
}
, 'frame', $frame, 'is_deduced', sub {
$current_frame->is_deduced(@_);
}
, 'load_rules', sub {
$current_frame->load_rules(@_);
}
, 'proclaim', sub {
$current_frame->proclaim(@_);
}
, 'trigger', sub {
$current_frame->trigger(@_);
}
, 'try_deduce', sub {
$current_frame->try_deduce(@_);
}
}
} |