Jaroslav Hajek wrote:
On Thu, Aug 27, 2009 at 2:07 PM, Jaroslav Hajek<address@hidden> wrote:
On Thu, Aug 27, 2009 at 12:54 PM, <address@hidden> wrote:
Bug report for Octave 3.1.55 configured for i686-pc-linux-gnu
Description:
-----------
builtin('subsref', ...) gives unexpected results or fails at all
Repeat-By:
---------
@bar/bar.m
function this = bar(a,b)
this = class(struct('a',a,'b',b), 'bar');
@bar/subsref.m
function r = subsref(this,idx)
r = builtin('subsref', this, idx);
octave:1> b = bar(42, 'foo')
octave:2> assert(class(b(1)),'bar')
error: assert (class (b (1)),'bar') expected
bar
but got
struct
error: called from:
error: /usr/local/share/octave/3.1.55/m/testfun/assert.m at line 234,
column 5
octave:2> assert( b.a, 42 )
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr
panic: Aborted -- stopping myself...
attempting to save variables to `octave-core'...
save to `octave-core' complete
Aborted
please try
http://hg.savannah.gnu.org/hgweb/octave/rev/8bf27324a9d0
Oops. Apparently there was a deeper problem behind - see following
patch(es). 3.2.x will get a separate simplistic fix.
John, Robert, does either of you want to look at this?
http://hg.savannah.gnu.org/hgweb/octave/rev/3d0d2bda3a0f
Apparently prior to this patch the dispatch_type stored in
octave_function was allowed to be different from the actual class as
given by pathname. The reason was that only load_path was able to
search parent classes (because it was storing the mappings) and
symbol_table loaded a separate copy for each descendant class, meaning
that a duplicate of the method body (parse tree) was created for each
descendant class (!). This is clearly undesirable, I think.
I think I essentially got that fixed by moving the parent_map to
symbol_table and handling it there. I'm not yet sure, however, whether
this doesn't break something else.
`make check' passes for me.
regards
When I wrote that code, I was definitely stumbling around in code I
didn't understand. JWE and I had a brief discussion about load_path
vs. symtab, but I don't understand symtab well enough to dork with it.
I will have to synch and build since I haven't done it in some weeks,
but will start that this afternoon sometime and look at the problem a
little more this evening after it is all done.
Bob
|