Hello Christian, hello Rocco, Nice to hear about your project! On Fri, Jan 17, 2003 at 02:46:10AM +0100, Christian Tismer wrote:
[...exceptions...] and I found one thing of his generated-c-approach appealing: Everything is turned back into generated C, and there is no question about exceptions: Surely they would be built like before.
Yes. I think that a good way to know the limit between the levels is, at first, by closely following the original C code --- but in essence only; constructions like the "return NULL" thing must clearly be ruled out, and replaced by higher-level Python constructs. Just as we are thinking about a "PyObject" base class for all Python objects, we should define an "EPython" exception that we can throw to signal a Python-visible exception, with whatever Python-visible exception we want being specified as attributes in the EPython instance. The EPython exception is caught in the main loop of the interpreter, at the point where CPython catches the cascade of "return NULLs". We can then generate CPython-like C code by adding NULL tests everywhere, or try alternatives (e.g. use the ANSI C setjmp()/longjmp() functions). There are lots of other variations on this theme. It would be possible and probably easy to generate Continuation-Passing-Style C code for the whole interpreter core, i.e. recreate Christian's old Stackless implementation for free. I guess that's something he has already considered :-) This can be done without having to write MiniPy in any special style in the first place. A bientot, Armin.