bugGNU Octave - Bugs: bug #55610, eval (code) when code could be...

 
 

bug #55610: eval (code) when code could be parsed as a command

Submitter:  John W. Eaton <jwe>
Submitted:  Wed 30 Jan 2019 08:45:36 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  jwe
Originator Name:  jwe Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 30 Jan 2019 09:29:28 PM UTC, comment #1: 

Oops, after taking another look at the test results, I think things are simpler than I initially thought.

If eval is called with nargout == 0, then the expression may be parsed as a command.  Otherwise, it is never parsed as a command.

My interpretation of what happens when foo is a variable in the examples in the original submission was incorrect.  Instead, if foo is a variable and we are parsing


eval ("foo -bar")


then it is an error because foo is known to be a variable but syntax says that this looks like a command.  Octave does not currently appear to behave correctly even outside of eval expressions.

There are still compatibility issues in Octave and I'm updating the tests but I think it should be more straightforward to fix.

John W. Eaton <jwe>
Group administrator
Wed 30 Jan 2019 08:45:36 PM UTC, original submission:  

When the eval function parses an expression, it must decide when to parse an expression like


foo -bar   ## (1)


as a command or subtraction expression.  Octave doesn't behave the same as Matlab now.  For example, any time eval is called with an output argument, the expression is not allowed to be a command.  This corresponds to not parsing the "foo -bar" part of expressions like


val = foo -bar


as commands even though


foo -bar


by itself is parsed as a command.

Similarly, if foo is known to be a variable, then the expression (1) above will not be parsed as a command.

See also bug #38576 and the following discussion on the maintainers mailing list: http://lists.gnu.org/archive/html/octave-maintainers/2019-01/msg00303.html

I'll update the file test/bug-38576.tst once I have a bug report number.

John W. Eaton <jwe>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

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 jwe (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 group members can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code