Closed jhellerstein closed 12 years ago
I like this idea. I would prefer the name exit
.
There can be multiple Bud interpreters inside a single process; it would probably be best to just have this facility shutdown the current interpreter rather than exit the whole process.
This also relates to the question of error handling in general.
Note that this can be accomplished easily enough by just putting side-effecting code on the RHS of a rule:
state do
scratch :die
scratch :dummy
end
bloom do
dummy <= die { do_shutdown }
end
(I haven't checked that that works; presumably some variant of do_shutdown
, stop_bg
or similar would suffice.)
thanks for feedback. resolved in 84d60a465fc26f785d9c
I agree that die
is a little extreme. chose to name the distinguished predicate halt
because exit
was coming up as a pre-defined symbol in Bud::define_collection. The implementation simply registers a scratch called halt with a callback that invokes stop_bg
. See test/tc_exit.rb
:
bloom do
halt <= tbl{|t| t if t.key == 2}
tbl <+ tbl{|t| [t.key+1]}
end
Perhaps a "die" relation?