'whos' with incorrect fields
David Bateman
David.Bateman at motorola.com
Wed Mar 12 12:45:34 CDT 2008
John W. Eaton wrote:
> On 12-Mar-2008, David Bateman wrote:
>
> | David Bateman wrote:
> | > John W. Eaton wrote:
> | >
> | >> On 12-Mar-2008, G.. wrote:
> | >>
> | >> |
> | >> | Let
> | >> |
> | >> | octave:1> A.a = B.b = 0 ;
> | >> | octave:2> whos A.A B.b
> | >> | error: structure has no member `A'
> | >> |
> | >> | *** local user variables:
> | >> |
> | >> | Prot Name Size Bytes Class
> | >> | ==== ==== ==== ===== =====
> | >> | rwd A.A 1x0 0 cs-list
> | >> | rwd B.b -1x-1 0 unknown
> | >> |
> | >> | Total is 1 element using 0 bytes
> | >>
> | >> Did you mean
> | >>
> | >> whos A.a
> | >>
> | >> ?
> | >>
> | >>
> | > I presume so.. However, that isn't the issue.. Octave should only return
> | > an error above and not print out anything..
> | >
> | > D.
> | >
> | >
> | >
> | Furthermore, in Octave 3.0.0 "whos A.a" prints the fields of the
> | structure, whereas in 3.1.x it doesn't.. This appears to be an issue
> | introduced with the new symbol table code.
>
> I consider the new behavior to be correct. The who and whos functions
> look for symbol names. A.a is not a symbol name so can't match an
> entry in the symbol table. Is this worth fixing in 3.0.x? I guess I
> would consider a patch.
>
> jwe
>
>
It is matlab compatible behavior. Does that make it correct? The
printing of structure fields was deliberately added. See the thread
http://www.nabble.com/Evaluating-struct-fields-in-whos-to9236889.html#a9236889
which was added with this patch
2004-07-23 Oyvind Kristiansen <oyvinkri at stud.ntnu.no>
* symtab.cc (symbol_record::subsymbols_list): New method.
(symbol_record::maybe_list): Call to subsymbols_list and merge
result with the original list of symbols.
This was also in the PROJECT file and removed prior to the 3.0 release. See
http://www.nabble.com/Cleaned-up-PROJECTS-file-to10639050.html#a10639050
I think the 3.0.0 behavior is useful and I'd like to see it in 3.1.x
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
More information about the Bug-octave
mailing list