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

- Andreas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to