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


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

Submitted by:  John W. Eaton <jwe>
Submitted on:  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:  John W. Eaton <jwe>
Originator Name:  jwe Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.


(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 jwe (Submitted the item)

    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.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5