patchGNU Octave - Patches: patch #10537, Support for InferiorClasses...

 
 

patch #10537: Support for InferiorClasses attribute

Submitter:  Thomas <kolmanthomas>
Submitted:  Fri 22 Aug 2025 03:40:28 AM UTC
   
 
Category:  Core : new feature Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Fri 22 Aug 2025 05:19:23 PM UTC, comment #2: 

Okay, I added more test cases. I don't think it's possible to declare classdefs inside a test block. I took a look at how the tests were done in test/classdef and test/classdef-load-save directories, they all had to put classdefs in separate files.

There's some unknown behaviour with method resolution when you have cyclic class precedence ordering, but I think that will be a bug for the function call resolver, not for parsing this attribute...


(file #57564)

Thomas <kolmanthomas>
Fri 22 Aug 2025 03:50:38 AM UTC, comment #1: 

I suggest some more tests to cover the error cases, especially if its possible to declare the classdef in the test block itself (?)


%!test
%! classdef (InferiorClasses = ?TotallyBogusNoSuchClass) MyClass
%!   methods
%!   end
%! end
%! error <what should happen> MyClass()


Colin Macdonald <cbm>
Fri 22 Aug 2025 03:40:28 AM UTC, original submission:  

I've added a patch to implement the InferiorClasses attribute. I've also added a new test directory for classdef attributes, so that if more attributes are supported, the testing of them is more centralized.

I'm unsure of what happens when two classes declare each other to be inferior. For example, doing something like


classdef (InferiorClasses=?Class2) Class1
  methods
      function retval = same_method (a, b)
          retval = 1;
      end
  end
end


and


classdef (InferiorClasses=?Class1) Class2
    methods
        function retval = same_method (a, b)
            retval = 2;
        end
    end
end


The current behaviour (with this patch) is that the superior class is the class that is last instantiated. If anyone could check the behaviour of this on MATLAB for me, I would be very grateful.

Thomas <kolmanthomas>

 

Attached Files

Attached Files
file #57564:  inferiorclasses_patch2.diff added by kolmanthomas (9.6KiB - application/octet-stream)
file #57559:  inferiorclasses_patch.diff added by kolmanthomas (6.0KiB - application/octet-stream)

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    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 logged-in users can vote.

     

    History

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-08-22 kolmanthomas Attached File- Added inferiorclasses_patch2.diff, #57564
    2025-08-22 kolmanthomas Attached File- Added inferiorclasses_patch.diff, #57559

    Back to the top

    Powered by Savane 3.16.
    Corresponding source code