bugGNU Octave - Bugs: bug #45833, support load/save of classdef...


bug #45833: support load/save of classdef objects

Submitter:  Mike Miller <mtmiller>
Submitted:  Thu 27 Aug 2015 12:09:04 PM UTC
Category:  Classdef Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 28 Aug 2015 11:06:01 AM UTC, comment #6: 

Parallel execution with the 'parallel' package, functions 'parcellfun' (local) or e.g. 'netcellfun' (cluster), relies on the values of single variables being transfered with Octaves save/load methods (currently 'save_binary_data()' is called). It must be recognized if sending (with a save method) a value failed, otherwise the reading process will just hang.

Since there may exist types derived from octave_base_value which can't be saved (as e.g. types provided by some packages), it is not feasible for the 'parallel' package to keep track which types can be saved and which can't. So if you should change the error into a warning, could you please provide an option of these methods to request the previous behaviour, i.e. an error?


Olaf Till <i7tiol>
Group Member
Thu 27 Aug 2015 09:37:58 PM UTC, comment #5: 

That's probably a good thing to do so that any strange octave_value object, like a 'magic colon' or 'lazy index', won't cause the save process to abort.

It still might be worthwhile to override the base save_ascii, load_ascii, save_binary, load_binary in ov-classdef.cc because then you could tailor the warning message.  Instead of

warning: octave_base_value::save_ascii(): wrong type argument 'object'

you could have something like that done for java objects

save: unable to save java objects, skipping

or for onCleanup objects

warning: onCleanup: load and save not supported

Rik <rik5>
Group administrator
Thu 27 Aug 2015 08:52:48 PM UTC, comment #4: 

Those functions already exist in the octave_base_value class.  They currently call gripe_wrong_type_arg.  That function already accepts an optional argument (default value = true) to say whether to issue an error or warning.  So this behavior should be fairly trivial to change.

John W. Eaton <jwe>
Group administrator
Thu 27 Aug 2015 08:35:31 PM UTC, comment #3: 

@jwe: It definitely would be a good idea to have placeholder save functions that issue a warning, but allow any other variables to be saved.  I did that for java objects recently in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/b22528fd3deb).  An important issue is that when Octave is in the midst of crashing it attempts to save all variables to the octave-workspace file.  If you happen to have a classdef object in the workspace then the saving of variables itself has an error and the entire workspace is lost.

Rik <rik5>
Group administrator
Thu 27 Aug 2015 06:51:00 PM UTC, comment #2: 

Also, would it make sense to change the error to just be a warning so that objects that could be saved are saved and the others are just skipped?

John W. Eaton <jwe>
Group administrator
Thu 27 Aug 2015 06:17:13 PM UTC, comment #1: 

In https://lists.gnu.org/archive/html/octave-maintainers/2014-08/msg00180.html, jwe mused whether adding support for classdef objects for all file formats might be a waste of time, and whether this would be a good time to deprecate some of the supported file formats, or only add support for new types to certain file formats, etc.

So load/save of classdef objects may or may not need to be implemented in all possible file formats, it may be worth further discussion.

Mike Miller <mtmiller>
Group Member
Thu 27 Aug 2015 12:09:04 PM UTC, original submission:  

Classdef objects cannot currently be loaded or saved:

>> x = inputParser;
>> save foo
error: octave_base_value::save_ascii(): wrong type argument 'object'
>> save -binary foo
error: octave_base_value::save_binary(): wrong type argument 'object'

Mike Miller <mtmiller>
Group Member


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

Attach Files:

No files currently attached


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by seijikun
  • -email is unavailable- added by i7tiol (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)

    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
    2024-01-23 mmuetzel CategoryInterpreter Classdef
    2019-06-27 seijikun Carbon-Copy- Added seijikun
    2019-02-26 mtmiller Carbon-CopyRemoved 80942 -
    2018-08-06 mtmiller Dependencies- bugs #54455 is dependent
    2015-08-27 mtmiller Dependencies- bugs #45831 is dependent

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code