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

 
 

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

Submitter:  Lars Kindermann <larskindermann>
Submitted:  Sat 23 Nov 2019 10:16:39 PM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 04 May 2021 09:12:25 PM UTC, comment #5: 

This was easy to fix.  I'm not sure why this bug languished for so long.  I changed the error message in this cset http://hg.savannah.gnu.org/hgweb/octave/rev/7460baab17ad.

The new message is "invalid empty index expression {}, use {:} instead".

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Mon 03 May 2021 03:44:51 PM UTC, comment #4: 

comment #2:

> Or at least there could be a hint in the error message, something like:
>
> error: empty index expressions {} are invalid now, use {:} instead


I definitely back this suggestion. My program used to work one year ago, and seeing it error like this is ugly at least :(

Francesco Potortì <pot>
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>
Group 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>
Group 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 pot (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by larskindermann (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-04 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    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.13-3230.
    Corresponding source code