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: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Unexpected Error
Status: ConfirmedAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: OpenRelease: 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.,

https://savannah.gnu.org/bugs/?46852

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

http://hg.savannah.gnu.org/hgweb/octave/rev/dcbd2ceadff1

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?)".

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 10 Sep 2017 11:33:10 PM UTCmtmillerSummaryInterpreter error with multiword commands previously used as variables=>syntax error on command syntax in script file when command is shadowed by a variable
    Sun 10 Sep 2017 11:31:47 PM UTCmtmillerStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1