bugGNU Octave - Bugs: bug #30666, error: invalid assignment to...

 
 

bug #30666: error: invalid assignment to cs-list outside multiple assignment.

Submitter:  Muhali <muhali>
Submitted:  Thu 05 Aug 2010 09:46:01 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 08 Aug 2010 07:44:59 PM UTC, comment #8: 

It seems that we don't need to fix this, but would it be worth changing the error notice to something slightly more understandable?

The MathWorks warning, 'Struct field assignment overwrites a value with class "function_handle"' is at least clear about what the problem is.

If we're not going to bother to change the message then we can close this bug report.

Rik <rik5>
Group administrator
Fri 06 Aug 2010 08:47:36 PM UTC, comment #7: 

Apparently, MathWorks agrees:

>> a = @sin ;
>> a.x = 1

??? Warning: Struct field assignment overwrites a value with class "function_handle".
 See MATLAB 7.0.4 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning for details.

a =

    x: 1

Judd Storrs <judd>
Fri 06 Aug 2010 06:48:46 PM UTC, comment #6: 

I agree with Judd. MathWorks even plainly admits it was a bug. I don't see why Octave should emulate it. In fact I think we should fix Octave to be a bit more strict about this because for instance
a = @sin
a.x = 1

is allowed as well.

Jaroslav Hajek <highegg>
Fri 06 Aug 2010 06:42:42 PM UTC, comment #5: 

The MATLAB 7.0.4 release notes do state that this warning will become an error in a future release of MATLAB. Since Mathworks recommends that all code should be rewritten I don't think it's particularly important to emulate an orphaned "feature".

I don't agree that this should be implemented because code that relies on it would behave unreliably with custom data types. One can easily have a different datatype (for example @myclass) that behaves both simultaneously as matrix and as struct such that, for example

a = myclass(2,1);
a.x = a ;

does not delete a and does not cause an error. Emulating the old behavior seems to just add a special case. Since even Mathworks is abandoning this behavior, my suggestion is to update your code.

Judd Storrs <judd>
Fri 06 Aug 2010 06:08:22 PM UTC, comment #4: 

Converting is done all the time without warnings (e.g. a = pi; a = 'pi'), so why issue a warning just for structures?

Having said that, if matlab warns, so should octave.

Muhali <muhali>
Fri 06 Aug 2010 05:24:03 PM UTC, comment #3: 

I asked a buddy to check this out in the M. Apparently M also hates it with this result:

>> a = ones(2,1) ;
>> a.x = a ;

??? Warning: Struct field assignment overwrites a value with class "double".
 See MATLAB 7.0.4 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning for details.

>>


The release note indicates that prior to 7.0.4 this would not produce an error and that the variable would be quietly converted to a structure. Additionally the release note goes on to politely explain that if you're doing this, you're doing it wrong.

http://www.mathworks.com/access/helpdesk/help/techdoc/rn/f22-1009915.html#f22-1008689

Judd Storrs <judd>
Fri 06 Aug 2010 05:13:09 PM UTC, comment #2: 

Why is this a bug?  How does Matlab behave?

Jaroslav Hajek <highegg>
Thu 05 Aug 2010 10:22:30 PM UTC, comment #1: 

Confirmed on a recent tip (8/5/10).

Rik <rik5>
Group administrator
Thu 05 Aug 2010 09:46:01 PM UTC, original submission:  

The following error was introduced somewhere between 3.2.4 and 3.3.52+:

octave> a = ones(2,1) ;
octave> a.x = a ;
error: invalid assignment to cs-list outside multiple assignment.

Muhali <muhali>

 

(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 judd (Posted a comment)
  • -email is unavailable- added by highegg (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-16 rik5 Open/ClosedOpen Closed
    2010-08-08 rik5 StatusConfirmed Wont Fix
    2010-08-05 rik5 CategoryNone Interpreter
        Item GroupNone Incorrect Result
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code