function handles & dispatch
Ben Abbott
bpabbott at mac.com
Tue Jun 23 06:24:50 CDT 2009
On Jun 23, 2009, at 5:58 AM, Jaroslav Hajek wrote:
> hi,
>
> scanning the Matlab online docs, I found this paragraph in the section
> on function handles:
>
> For nonoverloaded functions, subfunctions, and private functions, a
> function handle references just the one function specified in the
> @functionname syntax. When you evaluate an overloaded function by
> means of its handle, the arguments the handle is evaluated with
> determine the actual function that MATLAB dispatches to.
>
> I don't think Octave currently does this - only functions are looked
> for, and the function is fixed once the handle is evaluated. Can
> anyone verify this is true in Matlab? Should we change the behavior to
> be Matlab compatible?
>
> regards
I haven't implemented any overloading myself, but have used Matlab
toolboxes that do.
One nice example is CVX: Matlab Software for Disciplined Convex
Programming.
http://www.stanford.edu/~boyd/cvx/
Also, overloaded functions are included in Matlab's core functions.
.../Matlab_R2009a.app/toobox/matlab/datafun/@cell
.../Matlab_R2009a.app/toobox/matlab/datafun/@uint8
.../Matlab_R2009a.app/toobox/matlab/datafun/@uint16
These directories contain conv2.m, convnc.m, fft.m, fftn.m ifft.m, &
ifftn.m. The versions for double reside directly in the datafun
directory.
As the CVS license uses GNU General Public License 2.0, it would be
nice to be able to run it from Octave.
Ben
More information about the Octave-maintainers
mailing list