octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60882] error parsing command syntax


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #60882] error parsing command syntax
Date: Mon, 19 Jul 2021 13:05:32 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70

Follow-up Comment #15, bug #60882 (project octave):

You are right.
In Matlab R2021a:
On the command line:

>> clear all
>> a=1;
>> b=2;
>> a -b
Error: "a" was previously used as a variable, conflicting with its use here as
the name of a function or command.
See "How MATLAB Recognizes Command Syntax" in the MATLAB documentation for
details.


With a script:

>> type tst_command_script

a=1;
b=2

a -b
>> tst_command_script
Error: File: tst_command_script.m Line: 4 Column: 1
"a" was previously used as a variable, conflicting with its use here as the
name of a function or command.
See "How MATLAB Recognizes Command Syntax" in the MATLAB documentation for
details.


With a function:

>> type tst_command_function

function tst_command_function()

a=1;
b=2

a -b

end
>> tst_command_function
Error: File: tst_command_function.m Line: 6 Column: 1
"a" was previously used as a variable, conflicting with its use here as the
name of a function or command.
See "How MATLAB Recognizes Command Syntax" in the MATLAB documentation for
details.


The current behavior might be the best we can do when it comes to
compatibility and syntax extension.
Nevertheless, this change might be breaking some existing code that was
written for Octave.
Would it be possible to emit a warning about deprecated syntax in this case
and still recognize some operators which are currently treated as arguments?

Independent of this: Should we add a note about this in the NEWS file?

The documentation of the increment operators doesn't use spaces. Should we
write explicitly that spaces are discouraged/forbidden for the appended
increment and decrement operators (unless used in an assignment)?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60882>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]