What is Expressiveness in a Computer Language
Andreas Rossberg
rossberg at ps.uni-sb.de
Wed Jun 28 10:35:31 EDT 2006
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
More information about the Python-list
mailing list