<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625</link>
    <title>MATLAB Central Newsreader - Builtin function name resolution...</title>
    <description>Feed for thread: Builtin function name resolution...</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.nl/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 07 Jul 2012 17:32:11 +0000</pubDate>
      <title>Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882199</link>
      <author>dpb</author>
      <description>Hypothetical, mostly...well, not _entirely_ :)&lt;br&gt;
&lt;br&gt;
_IF_ (the proverbial "big if") one were to wish to extend a builtin &lt;br&gt;
function to add some functionality or to match syntax w/ a later rev, &lt;br&gt;
the easiest implementation would often be to add a function definition &lt;br&gt;
in the appropriate @class subdirectory of the same name that &lt;br&gt;
preprocesses the input and then passes that to the builtin method and &lt;br&gt;
then (possibly) postprocesses that output before returning.&lt;br&gt;
&lt;br&gt;
OK, the question is, how does one make the call to the builtin function &lt;br&gt;
in the overloading version in order to avoid recursion?  Or, is it even &lt;br&gt;
possible?&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 17:43:10 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882201</link>
      <author>Bruno Luong</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jt9rr1$dih$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; Hypothetical, mostly...well, not _entirely_ :)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; _IF_ (the proverbial "big if") one were to wish to extend a builtin &lt;br&gt;
&amp;gt; function to add some functionality or to match syntax w/ a later rev, &lt;br&gt;
&amp;gt; the easiest implementation would often be to add a function definition &lt;br&gt;
&amp;gt; in the appropriate @class subdirectory of the same name that &lt;br&gt;
&amp;gt; preprocesses the input and then passes that to the builtin method and &lt;br&gt;
&amp;gt; then (possibly) postprocesses that output before returning.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; OK, the question is, how does one make the call to the builtin function &lt;br&gt;
&amp;gt; in the overloading version in order to avoid recursion?  Or, is it even &lt;br&gt;
&amp;gt; possible?&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Surprise there _is_ a function called ... builtin() right on for that purpose.&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 18:02:07 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882207</link>
      <author>Matt J </author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jt9rr1$dih$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; postprocesses that output before returning.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; OK, the question is, how does one make the call to the builtin function &lt;br&gt;
&amp;gt; in the overloading version in order to avoid recursion?  Or, is it even &lt;br&gt;
&amp;gt; possible?&lt;br&gt;
=============&lt;br&gt;
&lt;br&gt;
As Bruno says, it's possible using BUILTIN, but it's a bad idea. Remember that a lot of common MATLAB functions are just ordinary mfiles which might call the function you're trying to extend and may not be prepared for the new functionality that you're adding to it. It's better/safer just to use a different name for the function.</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 18:34:35 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882212</link>
      <author>dpb</author>
      <description>On 7/7/2012 1:02 PM, Matt J wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jt9rr1$dih$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; postprocesses that output before returning.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; OK, the question is, how does one make the call to the builtin&lt;br&gt;
&amp;gt;&amp;gt; function in the overloading version in order to avoid recursion? Or,&lt;br&gt;
&amp;gt;&amp;gt; is it even possible?&lt;br&gt;
&amp;gt; =============&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; As Bruno says, it's possible using BUILTIN, but it's a bad idea.&lt;br&gt;
&amp;gt; Remember that a lot of common MATLAB functions are just ordinary mfiles&lt;br&gt;
&amp;gt; which might call the function you're trying to extend and may not be&lt;br&gt;
&amp;gt; prepared for the new functionality that you're adding to it. It's&lt;br&gt;
&amp;gt; better/safer just to use a different name for the function.&lt;br&gt;
&lt;br&gt;
Hmmm...I somehow missed builtin(); it was never referenced in the &lt;br&gt;
linkage or verbiage in sections on name resolution in my version and I'd &lt;br&gt;
not tried anything like this before...&lt;br&gt;
&lt;br&gt;
And, yes, I understand the caveats--which is why I did say it was &lt;br&gt;
(mostly) theoretical but I think I will do a little bit of &lt;br&gt;
experimentation to add some of the simpler enhancements to certain &lt;br&gt;
functions that have been done since my release.  If I'm reasonably &lt;br&gt;
careful w/ what I choose to play with and how I deal with the &lt;br&gt;
inputs/outputs, I should be able to retain compatibility.&lt;br&gt;
&lt;br&gt;
My intent is not to add anything that isn't consistent with newer syntax &lt;br&gt;
and to ensure that for existing functions the same is expected/returned &lt;br&gt;
as current.  If I can't achieve that goal on a given function in its &lt;br&gt;
entirety, I would hope I could at least trap the conditions and abort to &lt;br&gt;
the builtin first.&lt;br&gt;
&lt;br&gt;
But, since I'm retired and have no immediate prospects for any clients &lt;br&gt;
to return from the (growing ever more) distant past, it's not like I've &lt;br&gt;
any critical need that I can't just back out and revert to the present &lt;br&gt;
version either until I can fix a problem or devise a solution...&lt;br&gt;
&lt;br&gt;
Thanks (and Bruno, too...)...&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 19:11:08 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882216</link>
      <author>dpb</author>
      <description>On 7/7/2012 1:02 PM, Matt J wrote:&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
&amp;gt; As Bruno says, it's possible using BUILTIN, but it's a bad idea.&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
It works!!!!  :)  At least so far...&lt;br&gt;
&lt;br&gt;
My first exercise was to build a wrapper for find() that includes the &lt;br&gt;
'K' and 'first'|'last' optional inputs that this rev doesn't support.  I &lt;br&gt;
had built a function some time ago called MYFIND() but most of the time &lt;br&gt;
I forget even having done so or when doing some sample code just use &lt;br&gt;
FIND automatically that it really hadn't done me any good to have done so.&lt;br&gt;
&lt;br&gt;
The other thread just earlier than this got me thinking about it again &lt;br&gt;
and deciding I really, really, really wanted my version to have the &lt;br&gt;
facility.&lt;br&gt;
&lt;br&gt;
So far it hasn't broken anything else (knock on wood :) )...&lt;br&gt;
&lt;br&gt;
I have just a few others of the more common that I would like to do as &lt;br&gt;
well.  I don't mind fouling up the installation directories w/ my &lt;br&gt;
modifications; I'm never going to upgrade unless the client w/ really &lt;br&gt;
big bucks shows up and if that exceedingly unlikely event were to happen &lt;br&gt;
it'll be a whole new system anyway...&lt;br&gt;
&lt;br&gt;
I keep backups and the worst is I reinstall and copy stuff back from the &lt;br&gt;
version control system files on an incremental basis.  There's no &lt;br&gt;
critical data associated w/ Matlab here any longer--that's just too far &lt;br&gt;
in the past.&lt;br&gt;
&lt;br&gt;
I've spent quite a lot of time in the office playing the last couple of &lt;br&gt;
weeks owing to the extreme heat and drought conditions so there's no &lt;br&gt;
farming to be done and it's too hot to do anything that just doesn't &lt;br&gt;
_have_ to be done so I'm playing... :)&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 20:03:14 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882219</link>
      <author>Matt J </author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jta1kh$r4g$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; It works!!!!  :)  At least so far...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My first exercise was to build a wrapper for find() that includes the &lt;br&gt;
&amp;gt; 'K' and 'first'|'last' optional inputs that this rev doesn't support.  I &lt;br&gt;
&amp;gt; had built a function some time ago called MYFIND() but most of the time &lt;br&gt;
&amp;gt; I forget even having done so or when doing some sample code just use &lt;br&gt;
&amp;gt; FIND automatically that it really hadn't done me any good to have done so.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The other thread just earlier than this got me thinking about it again &lt;br&gt;
&amp;gt; and deciding I really, really, really wanted my version to have the &lt;br&gt;
&amp;gt; facility.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So far it hasn't broken anything else (knock on wood :) )...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have just a few others of the more common that I would like to do as &lt;br&gt;
&amp;gt; well.  I don't mind fouling up the installation directories w/ my &lt;br&gt;
&amp;gt; modifications; I'm never going to upgrade unless the client w/ really &lt;br&gt;
&amp;gt; big bucks shows up and if that exceedingly unlikely event were to happen &lt;br&gt;
&amp;gt; it'll be a whole new system anyway...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I keep backups and the worst is I reinstall and copy stuff back from the &lt;br&gt;
&amp;gt; version control system files on an incremental basis.  There's no &lt;br&gt;
&amp;gt; critical data associated w/ Matlab here any longer--that's just too far &lt;br&gt;
&amp;gt; in the past.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've spent quite a lot of time in the office playing the last couple of &lt;br&gt;
&amp;gt; weeks owing to the extreme heat and drought conditions so there's no &lt;br&gt;
&amp;gt; farming to be done and it's too hot to do anything that just doesn't &lt;br&gt;
&amp;gt; _have_ to be done so I'm playing... :)&lt;br&gt;
==============&lt;br&gt;
&lt;br&gt;
Well, that justifies doing it as much as one could hope to.  &lt;br&gt;
&lt;br&gt;
My fear wouldn't be things crashing, though. It would be the errors that are less noticeable -  incorrect output of usual MATLAB routines that are hard to detect. Even when doing toy projects, it can be frustrating to see output that doesn't jive with your intuition and then to have to wonder whether your own functions or Mathworks functions could be responsible. When doing this, I would surely want to do thorough testing or be sure that I'm defining a completely new calling syntax for the function (under the MATLAB version I'm running).</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 20:47:21 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882223</link>
      <author>dpb</author>
      <description>On 7/7/2012 3:03 PM, Matt J wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jta1kh$r4g$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
...&lt;br&gt;
&amp;gt;&amp;gt; My first exercise was to build a wrapper for find() that includes the&lt;br&gt;
&amp;gt;&amp;gt; 'K' and 'first'|'last' optional inputs that this rev doesn't support.&lt;br&gt;
...&lt;br&gt;
&amp;gt;&amp;gt; So far it hasn't broken anything else (knock on wood :) )...&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
&amp;gt; Well, that justifies doing it as much as one could hope to.&lt;br&gt;
&amp;gt; My fear wouldn't be things crashing, though. It would be the errors that&lt;br&gt;
&amp;gt; are less noticeable - incorrect output of usual MATLAB routines that are&lt;br&gt;
&amp;gt; hard to detect. ...&lt;br&gt;
&amp;gt; ... When doing this, I would surely want to do thorough testing&lt;br&gt;
&amp;gt; or be sure that I'm defining a completely new calling syntax for the&lt;br&gt;
&amp;gt; function (under the MATLAB version I'm running).&lt;br&gt;
&lt;br&gt;
Indeed, 'breaking' includes bad output, too.  And, if it did silently &lt;br&gt;
return a bum output from a core function that makes debugging more &lt;br&gt;
difficult if one has aliased the default either builtin or TMW-supplied &lt;br&gt;
m-files.  That is why I am always sure to keep both the original &lt;br&gt;
unmodified as well as using a VCS for updates to be able to revert &lt;br&gt;
easily if I do ever run into such a problem.&lt;br&gt;
&lt;br&gt;
I had tested the wrapper function around FIND pretty thoroughly before &lt;br&gt;
and it is one in which the added syntax is really quite simple to add as &lt;br&gt;
it is essentially just limiting the output to a subset of the full &lt;br&gt;
output when using the K optional argument and picking whether that goes &lt;br&gt;
from the front or the rear for the 'first'|'last' argument.&lt;br&gt;
&lt;br&gt;
Some others w/ more extensive changes could be far more challenging but &lt;br&gt;
I doubt I'll get _too_ carried away given it's just entertainment!  :)&lt;br&gt;
&lt;br&gt;
The most exotic I've done was to add operator support via mex-files for &lt;br&gt;
class SINGLE but I did that years and years ago when was still working &lt;br&gt;
and this was, in fact, the latest release.&lt;br&gt;
&lt;br&gt;
The next most was a piece I seem to have lost in the retirement move &lt;br&gt;
from the job and back to the farm--that was the implementation of a poor &lt;br&gt;
man's Fortran FORMAT output formatting facility--I can't seem to find &lt;br&gt;
that code on any of my machines--somehow I guess I never got a copy off &lt;br&gt;
a company machine to the house.  :(&lt;br&gt;
&lt;br&gt;
I had promised a copy of it to Steven L in a conversation when I brought &lt;br&gt;
up my obligatory complaint about C/Matlab formatting to support an &lt;br&gt;
enhancement request but haven't been able to do so... :(  It's now been &lt;br&gt;
so long I've really forgotten precisely how I did it even altho it &lt;br&gt;
mostly just passed FORMAT-like strings to a Fortran mex, obviously. &lt;br&gt;
When I first retired from employment and went on own, the work was doing &lt;br&gt;
wasn't using Matlab at all so it was several years before I discovered I &lt;br&gt;
didn't have it and too late to have any hope of retrieving anything.&lt;br&gt;
&lt;br&gt;
Anyway, that's _far_ more than anyone else is possibly interested &lt;br&gt;
in...I'll go away.  :)&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 21:20:01 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882226</link>
      <author>dpb</author>
      <description>On 7/7/2012 3:03 PM, Matt J wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jta1kh$r4g$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
...&lt;br&gt;
&amp;gt;&amp;gt; It works!!!! :) At least so far...&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; My first exercise was to build a wrapper for find() that includes the&lt;br&gt;
&amp;gt;&amp;gt; 'K' and 'first'|'last' optional inputs ...&lt;br&gt;
...&lt;br&gt;
&amp;gt; Well, that justifies doing it as much as one could hope to.&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
Ok, I now see one thing that doesn't _quite_ work as I'd like...&lt;br&gt;
&lt;br&gt;
I added descriptions of the additional syntax to the base m-file but &lt;br&gt;
even after a restart it still shows the original--is the actual text of &lt;br&gt;
the builtin functions help actually in the code itself and not using the &lt;br&gt;
m-file?  I had always thought that's why they were there--seemed no &lt;br&gt;
reason for them to even be distributed otherwise.&lt;br&gt;
&lt;br&gt;
So, is there no way to get the enhanced help w/o the specific naming of &lt;br&gt;
the overloaded function in the command?  Or am I overlooking something &lt;br&gt;
obvious here?&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 22:12:07 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882227</link>
      <author>Matt J </author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jta966$cnk$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; On 7/7/2012 3:03 PM, Matt J wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So, is there no way to get the enhanced help w/o the specific naming of &lt;br&gt;
&amp;gt; the overloaded function in the command?  Or am I overlooking something &lt;br&gt;
&amp;gt; obvious here?&lt;br&gt;
===========&lt;br&gt;
&lt;br&gt;
Does your find.m precede the native find.m on the MATLAB path?&lt;br&gt;
Type "which -all find.m" to check.</description>
    </item>
    <item>
      <pubDate>Sat, 07 Jul 2012 22:19:06 +0000</pubDate>
      <title>Re: Builtin function name resolution...</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/321625#882228</link>
      <author>dpb</author>
      <description>On 7/7/2012 5:12 PM, Matt J wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;jta966$cnk$1@speranza.aioe.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; On 7/7/2012 3:03 PM, Matt J wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; So, is there no way to get the enhanced help w/o the specific naming&lt;br&gt;
&amp;gt;&amp;gt; of the overloaded function in the command? Or am I overlooking&lt;br&gt;
&amp;gt;&amp;gt; something obvious here?&lt;br&gt;
&amp;gt; ===========&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Does your find.m precede the native find.m on the MATLAB path?&lt;br&gt;
&amp;gt; Type "which -all find.m" to check.&lt;br&gt;
&lt;br&gt;
Oh, DUH! &amp;lt;slaps head&amp;gt;  Forgot I had temporarily put a copy in my working &lt;br&gt;
directory for precisely that reason...&lt;br&gt;
&lt;br&gt;
I was sure I had made some corrections/additions to the help files over &lt;br&gt;
the years but w/ the replacing the builtin I let that confound me into &lt;br&gt;
thinking maybe something really deep was going on...&lt;br&gt;
&lt;br&gt;
Thanks...all's well now.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
  </channel>
</rss>
