help-octave
[Top][All Lists]
Advanced

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

RE: override display() for class


From: Steve White
Subject: RE: override display() for class
Date: Mon, 13 Dec 2010 00:03:09 +0100

Hi, Jaroslav!

I had failed to see this in the docs.  Yes argv was what I was looking for
(although the docs prefer inputname(1)).  But I still have questions.

Now I think the correct way to achieve consistency with other octave objects
is to override *both* display() and disp().

So as Pascal pointed out, display() is the function called when an assignment 
statement is executed without a semicolon.

    in Manipulating-Classes.html#Manipulating-Classes:
    Note that in the display method, it makes sense to start the method with 
    the line fprintf("%s =", inputname(1)) to be consistent with the rest of 
    Octave and print the variable name to be displayed when displaying the 
class. 

But then there is disp(), which explicitly is meant to print just a 
representation of the contents.

    in Terminal-Output.html#Terminal-Output:
    To print the value of a variable without printing its name, use the 
function disp. 
    Note that the output from disp always ends with a newline.


Wouldn't it be consistent to say that, typically, display(obj) should do 
    fprintf ("%s =", inputname(1));
    disp (obj);
?

But... there's also an fdisp().  Where does it end?
Ideally, one should only need to override one of these, and the defaults should
do the rest of the formatting.

Am I missing something here?

Thanks!
                                          


reply via email to

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