octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OOP and load/save


From: Robert T. Short
Subject: Re: OOP and load/save
Date: Fri, 24 Apr 2009 13:58:09 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16

John W. Eaton wrote:
On 24-Apr-2009, Robert T. Short wrote:

| BTW. IMHO, I am not at all sure the notion of converting the class to a | struct when the structure is unknown is valuable. I realize that it is | non-compatible, but this is one of those cases where it simply may not | be worth the effort. Returning a meaningful error would be just fine, | at least for my purposes.

Suppose you have a data file that contains some objects and some other
data, and the constructors for the objects are unavaiblle.  If you get
an error when reading the objects because you don't know how to
construct them properly, then that renders the entire data file
unreadable.  So continuing in some way with reading makes sense.  I
guess it would also be OK to skip the objects instead of converting
them, but if they are converted to structs you can at least examine
the data they contain even if they aren't useful as objects.

jwe



Good point. Basically, it seems to me that the MATLAB way of doing it is flawed, so some way of recovering is better than nothing at all.

Even if you could reconstruct the class (e.g., the parent list was part of the saved data), if the user had changed the class structure since saving it, the results would be a downer anyway. So, you are probably right. Returning the data so the user can see what he(she) did at least allows for sensible debugging and possibly a way of correcting the error. In fact, the more I think about the more I think you have the right of it. If I save some valuable data, then make changes, and then read the old data, I can probably make a converter that will make the old class match the new class. This could be very important.

So, tomorrow morning I will spend a couple of hours looking at this. Is there something you would particularly like me to look at?

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]