Date: Fri, 24 Feb 2006 10:57:12 +0100
From: Michael Wild <themiwi.REMOVE.THIS@student.ethz.ch>
User-Agent: Thunderbird 1.5 (X11/20051201)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Nested functions and oop
References: <ef2a03b.-1@webx.raydaftYaTP>
In-Reply-To: <ef2a03b.-1@webx.raydaftYaTP>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 47.10.3.213.fix.bluewin.ch
Message-ID: <43fed879$2@news1.ethz.ch>
X-Trace: news1.ethz.ch 1140775033 213.3.10.47 (24 Feb 2006 10:57:13 +0100)
Organization: Swiss Federal Institute of Technology (ETHZ)
Lines: 26
X-Authenticated-User: mwild
Path: news.mathworks.com!newsfeed-00.mathworks.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news.germany.com!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!news1.ethz.ch!not-for-mail
Xref: news.mathworks.com comp.soft-sys.matlab:332844



using function handles in this way seems to be a very convenient idea. 
and i don't think that it is cluttering the language, since this 
methodology doesn't really define methods, but rather registers them as 
data fields which happen to be function handles and thus are executable. 
it is more similar to registering callbacks in some gui-toolkit, or more 
general, in some well-known design-patterns.

as these function handles are not really methods, it is clear that they 
won't be called by matlab (how should it know about them being actually 
methods?).

what comes to mind, is using the conventional way of oop in matlab, but 
then register the methods in the way you showed. this enables you to get 
both: overloading and this convenient way of calling the callback. 
however, i'm not sure what this means with respect to polymorphism (does 
matlab support that?). it will probably fail utterly...

to be honest, i rarely ever use the oop feature offered by matlab. i 
just think it is too clumsy. tmw really should think about redoing the 
whole thing. for one: define a whole class in one file. and then 
handling member access is another thing which makes oop in matlab a real 
pain. it is just plain, that the oo feature whas plugged on top of a 
procedural language.


michael