[Changeset] ismethod and subsindex functions
David Bateman
David.Bateman at motorola.com
Fri Sep 26 10:25:08 CDT 2008
In my effort to look at documenting, and testing at the same time, the
new OOP fetaures, here is a patch that adds the subsindex and ismethod
functions. The subsindex function allows the conversion of a class
object into a valid index vector for use in indexing expressions. That
is something like
a = myclass (1:4);
b = 1:10;
c = b (a)
the conversion of a to an index of b is handled by the subsindex method
of the class. Note that Mathworks, in their wisdom or lack there of,
decided that subsindex should be a zero-based index where indexing
everywhere else in the matlab language is ones-based!!!!! And so
subsindex must return a zero-based index vector of the class double/logical.
The ismethod function is just the same function as in matlab as I
implemented as it was easy enough to add.
Note that I'm seeing some strange things with this patch in the same
manner as I saw previously for the thread
http://www.nabble.com/Another-OOP-issue-to19638982.html
That is
a = myclass (1:4);
b = 1:10;
c = b (a)
works, but then an additional call to "b(a)" results in the subsindex
method not being found and the default method being found instead. This
seems to be a generic issue with the OOP code. However, it is also
independent of this patch and so perhaps this patch should be applied in
any case. I believe that with the addition of the subsindex method and
the vertcat/horzcat overloading in [] that all of the operator
overloading capabilities are now in place.
Regards
David
--
David Bateman David.Bateman at motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8599
Url: https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080926/fd4d1758/attachment.ksh
More information about the Octave-maintainers
mailing list