bugGNU Octave - Bugs: bug #57297, empty cell index should return a...

 
 

bug #57297: empty cell index should return a more expressive error message

Submitted by:  Lars Kindermann <larskindermann>
Submitted on:  Sat 23 Nov 2019 10:16:39 PM UTC  
 
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Unexpected Error
Status:  Confirmed 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.

 

Tue 26 Nov 2019 11:23:11 PM UTC, comment #3: 

I don't think Octave will change to be incompatible with Matlab here.  But, it would be nice to have a more expressive error about what went wrong.  Adding jwe to the CC list since he dealt with the original bug #56167.

Rik <rik5>
Project Administrator
Sun 24 Nov 2019 02:45:57 AM UTC, comment #2: 

Ok, I see the history of this change now.

But it is surprising for a user if code that was running for years suddenly fails. It took me quite a while to figure out that the error was not caused by the content of the variable but due to  changed syntax. Shouldn't such changes go through a deprecation
period first and generate a warning only for some time?

Or at least there could be a hint in the error message, something like:

error: empty index expressions {} are invalid now, use {:} instead

Lars Kindermann <larskindermann>
Sat 23 Nov 2019 11:20:35 PM UTC, comment #1: 

Yeah this doesn't work anymore as of http://hg.savannah.gnu.org/hgweb/octave/rev/3140380861ce. See bug #56167 for some background.

Some weeks ago I've entered a bug report for a consequence of this (empty {} indexing) for an OF package (generate_html) where I hit this (bug #56853) and Markus Mützel supplied a patch for it in bug #57119.

I think this is going to be a case of "Won't fix" or "Invalid" but I'll let the core devs decide.

BTW, Matlab doesn't accept that construct:

>> format compact
>> a = {1}
a =
  1×1 cell array
    {[1]}
>> a{}
a{}
   ↑
Error: Invalid expression. When calling a function or indexing a variable, use parentheses.
Otherwise, check for mismatched delimiters.

Philip Nienhuis <philipnienhuis>
Project Member
Sat 23 Nov 2019 10:16:39 PM UTC, original submission:  

in all former versions, including 5.1 and current stable (and matlab, as far as I remember) I can use an empty cell index {} to get the element

octave:1> a={1}
a =
{
  [1,1] =  1
}

octave:2> a{}
ans =  1

but current dev returns an error instead

octave:1> a={1}
a =
{
  [1,1] = 1
}

octave:2> a{}
error: invalid empty index expression

Lars Kindermann <larskindermann>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by larskindermann (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-26 rik5 Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        StatusNone => Confirmed
        Summaryempty cell index returns an error => empty cell index should return a more expressive error message
        Carbon-Copy- => Added jwe
    2019-11-23 philipnienhuis Operating SystemGNU/Linux => Any

    Back to the top


    Powered by Savane 3.5