[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [plt-scheme] eval question

Shriram Krishnamurthi wrote:
> Bruce,
> The argument is simply that you would make about any sharp tool: are
> you sure you absolutely need it?  A lot of times people use EVAL for
> completely incorrect reasons.  I have even seen people who write
>   (eval 'x)
> when all they wanted to say was
>   x
> to access the variable's value!  To prevent abominations like this
> (and to avoid getting in the way of any analysis you might want to
> perform on your code), teachers recommend that their students not use
> EVAL at all.  That said, there are some legitimate uses for EVAL,
> though I couldn't offer you a taxonomy of them.  The uses in SXML are
> borderline legitimate.

An example would be Olin Shiver's embedded awk macro used in scsh; he 
writes in "A Universal Scripting Framework":

	"Whenever necessary, the user can break out of the special-purpose 
notation and express complex computations in a general-purpose 
programming language. The Scheme embedding makes simple things easy, and 
complex things possible..."

This is roughly what I had in mind although I could certainly restrict 
the user code to some arbitrary set of forms that are interpreted with a 
special-purpose evaluator.