[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53752] block comment compatibility
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #53752] block comment compatibility |
Date: |
Wed, 25 Apr 2018 11:54:18 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
URL:
<http://savannah.gnu.org/bugs/?53752>
Summary: block comment compatibility
Project: GNU Octave
Submitted by: jwe
Submitted on: Wed 25 Apr 2018 03:54:17 PM UTC
Category: Interpreter
Severity: 2 - Minor
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
We currently allow block comment markers to be mixed in any combination. So
'%{' and '#{' are equivalent as are '%}' and '#}'. This could cause
compatibility issues. For example, there could be some working Matlab code
that looks like this:
%{
block comment
#}
still a block comment in Matlab
%}
and that will fail in Octave. This could be solved by keeping track of
whether the current block comment started with '#{' or '%{' and requiring the
types of the begin and end markers to match. But even if we did that, the
following would work in Matlab but fail in Octave:
%{
block comment
#{
nested block comment in Octave but not Matlab
%}
sin (x); %% some other code that should be executed.
For that problem, I suppose we could require that to be nested, the nested
block comments must all be of the same type? Then the '#{' in the above code
would not be recognized as the beginning of a nested block comment. But that
would require more work for the programmer who wants to comment out a block of
code. Now they would need to check the block of code they are commenting for
existing block comments, and then use the same style.
A far simpler solution would be to only allow block comments to use '%{' and
'%}' instead of also allowing '#{' and '#}'...
I haven't seen any bug reports about this problem occurring in real code, so
I'm marking the severity as minor and the priority as low.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53752>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #53752] block comment compatibility,
John W. Eaton <=