metaprob
metaprob copied to clipboard
The trace for an application should be determined by the callee, not the caller
Currently the meta-circular interpreter's code for an application creates a trace whose subtraces are the traces for all arguments, the procedure evaluation, and the call to the procedure. This practice interferes with at least three extensions that I would like to see:
- we want the trace to be completely controllable (#51) - and the control should be exercisable not through macros or interpreter extensions, but via
inf
procedures or something that might be built using them. (In python-metaprob, trace control happened via the primitive syntaxwith-address
.) - tail recursion #23 - if it is to be adopted in some form
- factoring the interpreter into the syntactic and semantic processing phases (syntactic = expression dispatch, environment management, and procedure object decoding and encoding; semantic = dataflow of inference parameters and results; such a factoring would be valuable for reasons I hope are obvious; I should make a separate issue for this - ok, #85).
This change would be subtle and fussy. Also it might require passing additional parameters to an inf
and adjusting all of our current inf
definitions. But is not particularly complicated conceptually. The trace-building code for applications would just get moved out of infer
and into infer-apply
(the procedure entry and exit logic).