unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <87lh89uw87.fsf@gmail.com> (raw)
In-Reply-To: jwvbn958jp0.fsf-monnier+gmane.emacs.help@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> 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	other threads:[~2016-01-01 15:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-30 12:35 Is there a way to instrument for edebug a form (say, a progn) given to `eval'? Marcin Borkowski
2015-12-30 17:11 ` Drew Adams
2015-12-30 17:29 ` Michael Heerdegen
2016-01-04 22:30   ` Marcin Borkowski
2016-01-04 22:58     ` Drew Adams
2016-01-05  9:26       ` Marcin Borkowski
2016-01-04 23:26     ` Michael Heerdegen
2016-01-05  9:16       ` Marcin Borkowski
2016-01-05 20:00         ` Michael Heerdegen
2016-01-05 20:08           ` Marcin Borkowski
2016-01-05  4:41     ` Stefan Monnier
2016-01-05  9:04       ` Marcin Borkowski
2016-01-05 12:43         ` Stefan Monnier
2016-01-01 13:48 ` Thorsten Jolitz
2016-01-01 14:22   ` Stefan Monnier
2016-01-01 15:59     ` Thorsten Jolitz [this message]
2016-01-02 17:39       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lh89uw87.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).