What is Expressiveness in a Computer Language

David Hopwood david.nospam.hopwood at blueyonder.co.uk
Wed Jun 28 18:25:22 CEST 2006


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 <david.nospam.hopwood at blueyonder.co.uk>



More information about the Python-list mailing list