bugGNU Octave - Bugs: bug #53752, block comment compatibility


bug #53752: block comment compatibility

Submitted by:  John W. Eaton <jwe>
Submitted on:  Wed 25 Apr 2018 03:54:17 PM UTC  
Category:  Interpreter Severity:  2 - Minor
Priority:  2 Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  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 25 Apr 2018 04:13:20 PM UTC, comment #1: 

I can't imagine this is a frequent issue, and there are easy workarounds.  At best, maybe it is worthwhile to implement the first suggestion to track what the opening block comment character was.  The second scenario seems quite esoteric.  I lowered the priority even more to 2 rather than 3.

Rik <rik5>
Project Administrator
Wed 25 Apr 2018 03:54:17 PM UTC, original submission:  

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.

John W. Eaton <jwe>
Project Administrator


(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 rik5 (Posted a comment)
  • -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.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-25 rik5 Priority3 - Low => 2
    2018-04-25 jwe Priority5 - Normal => 3 - Low

    Back to the top

    Powered by Savane 3.5