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$>
References: <ghrlim$oqo$> <ghv5ut$fj7$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1229145019 29469 (13 Dec 2008 05:10:19 GMT)
NNTP-Posting-Date: Sat, 13 Dec 2008 05:10:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:506691

"us " <> wrote in message <ghv5ut$fj7$>...
> "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