Andreas Rossberg wrote: > David Hopwood wrote: > >> (In the case of eval, OTOH, >> the erroneous code may cause visible side effects before any run-time >> error occurs.) > > Not necessarily. You can replace the primitive eval by compile, which > delivers a function encapsulating the program, so you can check the type > of the function before actually running it. Eval itself can easily be > expressed on top of this as a polymorphic function, which does not run > the program if it does not have the desired type: > > eval ['a] s = typecase compile s of > f : (()->'a) -> f () > _ -> raise TypeError
What I meant was, in the case of eval in an untyped ("dynamically typed") language. The approach you've just outlined is an implementation of staged compilation in a typed language. -- David Hopwood <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list