bugGNU Octave - Bugs: bug #46136, error messages for stacks of...


bug #46136: error messages for stacks of anonymous functions not informative enough

Submitter:  Olaf Till <i7tiol>
Submitted:  Tue 06 Oct 2015 10:10:49 AM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  lachlan
Originator Name:  Olaf Till Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Wed 10 Aug 2016 04:08:53 PM UTC, comment #4: 

I applied the refreshed patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/dbf7fd79e391).  Fixed, closing report.

Rik <rik5>
Project Administrator
Tue 09 Aug 2016 02:37:42 PM UTC, comment #3: 

I've uploaded the refreshed original patch.

What regards the addition of printing the anonymous function definition, I didn't leave it out because it was too difficult for me to implement, but because I thought leaving it out is better. I would have added it if a discussion of this would have come to a different end. If you really want to add it yourself, I'd think the correct way is to first apply the original patch and afterwards make a change with a patch of yourself. I don't think it's correct to make a patch of yourself by changing the original patch.

(file #38156)

Olaf Till <i7tiol>
Project Member
Mon 08 Aug 2016 11:59:11 PM UTC, comment #2: 

@Lachlan: Can you update Olaf's patch?  It no longer applies cleanly to the tip.

Why is a header file removed with a comment rather than leaving in or just deleting the line entirely?

+//#include "ov-fcn-handle.h"

Rik <rik5>
Project Administrator
Mon 04 Jul 2016 12:33:21 PM UTC, comment #1: 

Olaf's patch still applies.

The attached patch displays the text of the anonymous function, like Matlab does.  In general, I like giving users as much information as possible, as explicitly as possible.

(file #37703)

Lachlan Andrew <lachlan>
Tue 06 Oct 2015 10:10:49 AM UTC, original submission:  

With the attached example functions 'f1.m' and 'f2.m' in the path, I'd expect something like the following error message for calling 'f1 ();':

error: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x2)
error: called from
    f1>@<anonymous> at line 3 column 20
    f1>@<anonymous> at line 5 column 32
    f1>@<anonymous> at line 9 column 34
    f2>@<anonymous> at line 3 column 26
    f2 at line 5 column 3
    f1 at line 11 column 3

But what I currently get is:

error: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x2)
error: called from
    f1> at line -1 column -1
    f2> at line -1 column -1
    f2 at line 5 column 3
    f1 at line 11 column 3

I.e. the chief point is that line and column information is lacking. (The reduced number of messages is probably due to the fact that the error function eats messages which appear to be equal; this will cause no problems anymore if the line information is present, so that the messages are not equal anymore.)

With the changeset (attached as soon as I have the bug number), the messages are as shown above as those I'd expect.

Notes to the changeset:

- Matlab prints e.g.

Error in f1>@(x,y)x/y ...

instead of

    f1>@<anonymous> ...

but I don't think this is necessary as long as the line information is present to allow looking up the function definition in the user code.

- I didn't check for

tree_evaluator::statement_context == tree_evaluator::other

in the calling context, so if both the anonymous function definition and the anonymous function call are from the command line, always 1 is printed for the line number, and the column number is correct. But this seems better to me than printing line=-1 and column=-1 in this case.

- I don't know if it is good or necessary to make a test for this bug.

Olaf Till <i7tiol>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #38156:  anon-func-error-stack-2.cset added by i7tiol (2KiB - application/octet-stream)
file #35084:  anon-func-error-stack.cset added by i7tiol (2KiB - application/octet-stream)
file #35082:  f1.m added by i7tiol (169B - text/x-objcsrc)
file #35083:  f2.m added by i7tiol (95B - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by i7tiol (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.





    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-10 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2016-08-09 i7tiol Attached File- Added anon-func-error-stack-2.cset, #38156
    2016-07-04 lachlan Assigned toNone lachlan
    2016-07-04 lachlan Attached File- Added bug_46136_anon_func_error_stack.cset, #37703
    2015-10-08 mtmiller StatusNone Patch Submitted
    2015-10-06 i7tiol Attached File- Added anon-func-error-stack.cset, #35084
    2015-10-06 i7tiol Attached File- Added f1.m, #35082
        Attached File- Added f2.m, #35083

    Back to the top

    Powered by Savane 3.9