bugGNU Octave - Bugs: bug #51820, OO: default values invoking...

 
 

bug #51820: OO: default values invoking constructor without arguments.

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Tue 22 Aug 2017 02:36:41 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Duplicate 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 22 Aug 2017 08:54:10 PM UTC, comment #2: 

Dear Mike, there it was classified as a wish.
This is not true from what is mentioned here about matlab.
Please update the other bug: no wish, bug.

Thank you.

Ernst Reissner <ernstreissner>
Tue 22 Aug 2017 05:12:34 PM UTC, comment #1: 

This was already reported, see bug #50367. In that bug report it was already confirmed that this is a lacking feature for legacy style classes, but does work correctly with classdef classes.

Mike Miller <mtmiller>
Group Member
Tue 22 Aug 2017 02:36:41 PM UTC, original submission:  


I have written a (legacy) class implementing arithmetics in java, called pn
for polymorphic number.

have a look at
https://www.mathworks.com/help/matlab/matlab_oop/class-constructor-methods.html#btn2kiy,
to be more precise to the guidelines
talking about constructors without arguments.
This refers to

When creating or expanding an object array such that not all elements are given specific values, the class constructor is called with no arguments to fill in unspecified elements


This is true even outside oo:
a(5)=1 on unkown a performs padding a(1)...a(4)
with default value 0.
Consequently,
a(5)=pn(1) performs padding a(1)...a(4)
with default value pn() which represents 0 also in my case.

Unlike prior releases, now pn() does not get invoked.
Instead some raw constructor seems to be invoked,
merely applying function class(...)
but not providing a sensible default value.


Ernst Reissner <ernstreissner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-22 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #50367
    2017-08-22 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code