MAT.jl icon indicating copy to clipboard operation
MAT.jl copied to clipboard

RW support for function handles

Open foreverallama opened this issue 1 month ago • 1 comments

Reference: #221

  • Added new basic type FunctionHandle
  • Read support in v7 and HDF formats
  • Updated test for function_handles.mat to reflect new type

TODO: Add write support

If the new type is sufficient then I'll move on to writing.

foreverallama avatar Dec 10 '25 18:12 foreverallama

Added write support for function handles

  • Removed standalone read test and incorporated it into write.jl as its easier to read then write.
  • Added constants for the MATLAB_object_decode attribute

Some types of function handles use opaque objects which revealed some bugs which has been fixed:

  • Fix: Writing objects with an object ID = 0
  • Fix: Serializing nested properties uses a copy for structs/cells to avoid overwriting the property value with object metadata. I think the copy is cheap as it should be copying references. Now we're only modifying the copy with nested object metadata (if any) instead.

These bugs are implicitly tested with RW for function handles.

I think the FunctionHandle type can be extended as a Dict like the other types. It'll keep things uniform

foreverallama avatar Dec 11 '25 11:12 foreverallama