[racket] Use of map and eval to evaluate symbol in namespace

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Mon Jul 28 15:46:53 EDT 2014

I don't know the current state of the "eval" docs in the manual, but I 
think they should have a big warning at the very front, intended to 
scare away newbies.

Remember that Racket is often used in conjunction with many different 
Scheme-based and other Lisp-based textbooks and courses. It seems that 
many CS instructors and textbook authors like to talk about ``EVAL'' (as 
an abstract operation) when talking about some models of evaluation, and 
"eval" (as an accessible language binding) to say, gosh, aren't dynamic 
languages interesting and powerful. So, we can't blame every fourth 
newbie for trying to use "eval" unnecessarily, in ways that make for bad 
software engineering.

Given this reality of confusing instruction, I'm thinking that, as a 
reactive measure, "#lang paddle" will disable "eval" by default. 
Attempting to use "eval" will give you an error message, unless you have 
an assertion form like 
"(i-have-read-the-foo-document-and-understand-that-eval-is-usually-the-wrong-thing-but-honest-i-know-what-i-am-doing)".

Cheers,
Neil V.

Vincent St-Amour wrote at 07/28/2014 02:21 PM:
> Maybe this should be linked to from the `eval' docs?
>
> http://blog.racket-lang.org/2011/10/on-eval-in-dynamic-languages-generally.html
>
> Vincent
>
>
> At Sun, 27 Jul 2014 16:16:52 -0400,
> Neil Van Dyke wrote:
>> Maybe there should be a periodic public service announcement about not
>> using "eval".  This time I will communicate in FAQ format:
>>
>> Q: How do I use eval?
>> A: Don't use eval.
>>
>> Q: But don't so many academic books feature eval prominently, so doesn't
>> that mean I should use try to eval?
>> A: Those books use eval for pedagogic reasons, or because the author is
>> enamored of some theoretical appeal of eval, or because the author wants
>> to watch the world burn.  Don't use eval.
>>
>> Q: But, but, but, I am just starting to learn, and eval seems to do what
>> I need.
>> A: Eval is almost certainly not what you want.  Learn how to use the
>> other basics effectively.  Don't use eval.
>>
>> Q: I now am very comfortable with the language, I am aware that I should
>> avoid eval in almost all cases, and I can tell you why eval is actually
>> the right thing in this highly unusual case.
>> A: Cool, that's why eval is there.
>>
>> Neil V.
>>


Posted on the users mailing list.