Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Why does everyone hate 'eval'?
Date: Sat, 13 Dec 2008 05:10:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <ghvg3r$sot$1@fred.mathworks.com>
References: <ghrlim$oqo$1@fred.mathworks.com> <ghv5ut$fj7$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229145019 29469 172.30.248.38 (13 Dec 2008 05:10:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 13 Dec 2008 05:10:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:506691

"us " <us@neurol.unizh.ch> wrote in message <ghv5ut$fj7$1@fred.mathworks.com>...
> "Johan Carlson"
> > I've been running into comments like "NO, NO, NO, WHATEVER YOU DO,  DO NOT USE EVAL!!!!' in various posts during the past few weeks...
> 
> these lovely people are absolutely correct - and - let me add this, after having used ML for 26 years - there is absolutely NO evil eval, which you cannot possibly replace by a genuine string of ML commands or stock functions...
> 
> us

  I was afraid I might stir up a reaction from you on this point, Urs.  More than once in this newsgroup you have pointed out to me, and rightly so, a use I had made of 'eval' that was not well-advised.  Still, I do not accept unreservedly your statement that "these lovely people are absolutely correct" in reference to never using 'eval'.  I would like to reserve the right to use it when the situation seems appropriate (and even a few where it is inappropriate.)

  I grant you the validity of your claim that 'eval' CAN always be replaced by other more standard code, but that doesn't necessarily imply that it SHOULD be in every case.  To claim that there is always a better way than using 'eval' no matter what the problem is would be a much stronger statement but one I disagree with.  There are simply too many conceivable computing tasks that could be devised by the resourceful human brain to be sure of such a claim, in my opinion.

Roger Stafford