help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is there a way to instrument for edebug a form (say, a progn) given


From: Thorsten Jolitz
Subject: Re: Is there a way to instrument for edebug a form (say, a progn) given to `eval'?
Date: Fri, 01 Jan 2016 16:59:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Probably bad and slow for some Lisps with compiler, but for interpreted
>> Lisps (as long as users can't abuse it)?
>
> The reason eval is evil has nothing to do with performance: it's
> a software engineering issue.  It's kind of like using nconc instead of
> append, except magnified many times.

I must admit I still don't get it.

The arguments I find here (e.g.):

,----
| "clojure - Why exactly is eval evil? - Stack Overflow"
| 
http://www.google.de/search?ie=UTF-8&oe=UTF-8&q=whats+wrong+with+eval+in+lisp&gws_rd=cr&ei=d5yGVrSkIIfcPNSOhIAD
`----

almost all relate to compiler issues (except security and readability)

,----
| So, the answers so far are:                      
|                                                           
|   * Not validating input from users and sending to eval is
|     evil                                                  
|   * Using eval I may end up with interpreted code instead 
|     of compiled                                           
|   * Eval could make code unreadable (although I think one 
|     can write unreadable code without any "powerful"      
|     features, so this is not much of an issue)            
|   * Beginners may be confused mixing compile-time and     
|     evaluation-time when mixing eval and macros (but I    
|     think it's not an issue once you get a firm grasp of  
|     how your language works -- be it Lisp or other)       
`----

In another related post

,----
| 
http://blog.racket-lang.org/2011/10/on-eval-in-dynamic-languages-generally.html
`----

again the compiler argument seems to be the most reasonable:

" [...] a program that uses eval.  It can't be compiled and optimized as well
as the earlier paragraph, and the language context in which it is run
may change the result."


But in an interpreted Lisp without a Compiler, moving around lists as
data and 'eval' them at some point still appears like a great feature to
make programs short and readable to me.

--      
cheers, 
Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]