bugGNU Octave - Bugs: bug #51988, syntax error on command syntax in...


bug #51988: syntax error on command syntax in script file when command is shadowed by a variable

Submitted by:  None
Submitted on:  Sun 10 Sep 2017 10:48:27 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  Confirmed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  4.2.1
Operating System:  Microsoft Windows

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 10 Sep 2017 11:48:14 PM UTC, comment #3:

This is not really the same issue as bug #46852. That issue is about a clear "out of bounds" message when indexing a variable that shadows a function. This issue is about an unclear "syntax error" message when a variable shadows a function that is called specifically using command syntax without parentheses.

Mike Miller <mtmiller>
Project Administrator
Sun 10 Sep 2017 11:42:32 PM UTC, comment #2:

This issue or something similar has been discussed previously, e.g.,


Look through that to see if it is the same issue. Perhaps any changes in the message were after 4.2.1. There's a changeset here


where language "shadows" was introduced.

As you pointed out, it is very easy to not be aware that a function has been over-written by some choice of variable name. As such, it's not immediately obvious what has happened.

Dan Sebald <sebald>
Sun 10 Sep 2017 11:31:47 PM UTC, comment #1:

Thanks for your bug report. I can confirm this, it looks like a slightly different manifestation of bug #48031.

Mike Miller <mtmiller>
Project Administrator
Sun 10 Sep 2017 10:48:27 PM UTC, original submission:

The statement "axis equal;" kept triggering a parse error in a script foo.m but it was restricted to that specific file foo.m and no others. After much hair-pulling, including searching for invisible Unicode characters, it turned out that there had been a previous variable named axis, long since cleared by the time "axis equal" was called with its graphics meaning.

In foo.m, the variable axis was renamed and the problem stopped. But when most variables are cleared and then invoked, Octave either invokes a function or script by that name or gives a "reference to cleared variable" error. A bald "parse error" is triggered only by certain two-word commands like "hold on" and "axis equal" and "format compact" -- it appears that the interpreter gets confused with the use of a command that used to be a variable for those multi-word forms alone. However calling axis "equal" with the argument in quotes does work even without patentheses -- cleared variables stay cleared and the interpreter does not error out.

If this behavior must remain the way it is, please consider changing the parse error to "Parse error (was this command used earlier as a variable?)".



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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-10 mtmiller SummaryInterpreter error with multiword commands previously used as variables => syntax error on command syntax in script file when command is shadowed by a variable
    2017-09-10 mtmiller StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.3