Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Why does everyone hate 'eval'?
Date: Thu, 11 Dec 2008 20:15:05 +0000 (UTC)
Organization: Xoran Technologies
Lines: 7
Message-ID: <ghrsc8$194$1@fred.mathworks.com>
References: <ghrlim$oqo$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229026505 1316 172.30.248.35 (11 Dec 2008 20:15:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 11 Dec 2008 20:15:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:506418


The one time that I have found eval() indispensible is in creating overloaded subsref/subsasgn methods for classes.

Calling subsref()/subsasgn() by themselves is known to produce unpredictable behavior because of dispatching rules, but if you execute the equivalent expression using eval this tends not to happen.