[plt-scheme] Re: Novice question: evaluating symbols

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Fri Jan 8 10:21:58 EST 2010

On Fri, Jan 8, 2010 at 10:10 AM, Grant Rettke <grettke at acm.org> wrote:
> On Fri, Jan 8, 2010 at 8:17 AM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> Turning symbols into identifiers at runtime is fundamentally an
>> eval-like thing and should be avoided in any well-designed language
>> (to get in my high horse for a moment).
>
> Are there any good papers or posts on the topic?

Well, there's my response to a similar question you asked about a year
and a half ago:
http://list.cs.brown.edu/pipermail/plt-scheme/2008-April/024140.html

> It might be interesting to see a list of the good uses...
> structure-related functions come to mind. Surely there are more?

Eval is for compiling and running (full, separate) programs.  It is
not a good tool for "glue code" to solder together two parts of a
single program that share variable names.  It is useful for building
an interpreter or test framework for running programs end-to-end, but
it's too heavyweight for anything smaller than that.  To paraphrase
the internet, evaluation is serious business.  ;)

On the other hand, as I said, there's nothing wrong with exploring
eval as a newcomer to Scheme.  Exploratory programming is a perfect
place for heavyweight solutions because, hey, you might learn
something.  I expect 90% of the lesson is "eval was not worth it", but
there's also the other 10% of how to use it properly when you do
actually need it.

--Carl


Posted on the users mailing list.