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: Thu, 23 Apr 2009 14:31:20 -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 23-Apr-2009, Robert T. Short wrote:

| John, let me make a proposal. I think I can do a fairly quick fix that | is ALMOST correct. That way, folks (like me) can use the OOP facilities | without worrying about long-term breakage. Then I (or you or whoever) | can take the time to really think about a correct implementation.

I'd really prefer to try to get a correct and more or less complete
implementation from the start.

You da boss!
| Suppose that I read the .mat file without concerning myself about the | parent structure. This involves simply creating an octave_class, | setting the class name, and then creating a octave_map, I think | (actually, I recall Cells being used, but I think we can still do this). | | Then I can walk through the elements in the map. IF the map elements | are objects AND the object's class name is the same as the name of the | struct field, just assume that I have a derived class. Add it to the | parent list for the class. This has to recurse of course for multiple | levels of inheritance.

Instead of faking it, let's keep track of the classes that we have
constructed, and then look at those for the parent and field info.
Then if there is a mismatch, we can report it.  If an exemplar doesn't
exist, you can call the constructor to attempt to create one.

I've checked in a patch that implements the storing of exemplars, and
checks newly constructed objects against them, so if the constructor
changes and the object is different, we will now get an error (a
diagnostic that was previously missing in Octave).  The patch for this
is here:

  http://hg.savannah.gnu.org/hgweb/octave/rev/d8f9588c6ba1

I've also updated my previous patch to look for objects in the
exemplar map before attempting to call the constructor.  My current
draft is attached below.  I haven't checked it in since it is still
not complete, and I think it should use some more testing.

We also still need to implement things like "clear classes".

jwe

OK. I won't do much more before Saturday morning but will try to eyeball and catch up before then. I have painfully acquired an understanding of this code, but you will get there much, much faster.

Just let me know where you are so that I don't try to duplicate any effort.

Thanks,

Bob


reply via email to

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