[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Derived Objects and OOP
From: |
John W. Eaton |
Subject: |
Re: Derived Objects and OOP |
Date: |
Sat, 28 Mar 2009 13:27:46 -0400 |
On 28-Mar-2009, Robert T. Short wrote:
| John W. Eaton wrote:
| > On 28-Mar-2009, Robert T. Short wrote:
| >
| > | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
| > | <html>
| >
| > Can you disable the HTML goop when writing to the lists?
| >
|
| Grumble. This mail thing used to ask me about this. I will watch this
| in the future. I am trying with this mail, but am not sure if I know
| how to turn it off so let me know if it still comes in as HTML.
I just got plain text this time. Thanks.
| > Are you sure? The description of the MAT-file format doesn't mention
| > parent class names. It says that an object is stored the same as a
| > structure with the name of the class. Octave already does this, so
| > I'm not sure there is anything to change.
|
| No I am not sure. I guess this was really a "note to Bob" to make sure
| that things work sensibly. I am not at all sure there IS anything to be
| done, since saving the object should really just save the structure and
| that is probably already done. There might be something to do to make
| sure that the load process re-creates the parent list.
I'm not sure I see how that would be done. What does Matlab do, if
the Matlab MAT file format doesn't seem to have any place to store
parent class info.
| > | | - Assigning a class to the result of a parent method doesn't work. See
| > | | the script "ClassTest.m" for examples.
| > |
| > | I don't understand what you mean by this.
| > | </pre>
| > | </blockquote>
| > | This is actually very important. IMHO, without this feature the
| > | implementation is only half-baked.
| > |
| > | Here is what I mean by this (look at the examples provided in the
| > | tarball for details on the class implementation).
| > |
| > | Consider a class hierarchy
| > |
| > | ClassName DirectoryName Parent Method
| > | Snork
| > | @Snork
| > | None gick (set and return the value of the property
| > | gick)
| > | Dork
| > | @Dork
| > | Snork gack (set and return the value of the property gack)
| > |
| > | The following code fragment, taken from the ClassTest.m script, creates
| > | a Snork object with the default value of gick, and then changes the
| > | value of gick to 2. This works fine.
| > | snk = Snork();
| > | snk = gick(snk,2)
| > |
| > | However, the next code fragment does not work.
| > | drk = Dork()
| > | drk = gick(drk,2) % This
| > | doesn't work.
| > | What it <i>should</i>
| > | do is set the value of the gick property in the drk.Snork field to
| > | 2. That is, after the second line is executed typing gick(drk)
| > | should return 2.
| >
| > What's needed to make that happen?
| >
|
| As far as implementation I have no clue (yet). I have been looking
| through all of the tree evaluation stuff just trying to make sure I know
| what it does before I go tapdancing through the sources.
|
| Using the example above, if the invocation is gick(drk), then the Snork
| field of drk should be updated with the results of the gick function.
| In general, the parent tree must be traversed to find the appropriate
| structure field for the class that owns the method and that structure
| field updated with the result of the method function.
OK, that's the kind of information I was looking for, not necessarily
exactly what the detailed implementation would be in Octave. So who
is responsible for looking for parent classes in this case? I'm not
sure I have a clear picture of what is supposed to be happening here,
and unfortunately I also don't have a lot of time to spend working on
this problem at the moment.
jwe