Fwd: Re: [Rd] Implementation of the names attribute of attribute lists

Martin Maechler maechler at stat.math.ethz.ch
Wed May 11 09:37:16 CEST 2005

>>>>> "Gabriel" == Gabriel Baud-Bovy <baud-bovy.gabriel at hsr.it>
>>>>>     on Tue, 10 May 2005 19:00:53 +0200 writes:

    Gabriel> Hi Martin,
    Gabriel> Thanks for your reply. I am responding on r-devel to
    Gabriel> provide some examples of outputs of the function that
    Gabriel> I had list in the post-scriptum of my previous
    Gabriel> email (BTW, did my post went through the list? I
    Gabriel> subscribed only after mailing it).

    Gabriel> You wrote:

    >> Just to ask the obvious:
    >> Why is using  str() not sufficient for you and instead,
    >> you use  'print.object' {not a good name, BTW, since it looks like a
    >> print() S3 method but isn't one} ?

    Gabriel> Would printObject or printSEXP a better name?

definitely better because not interfering with the S3 pseudo-OO convention...
Still not my taste though :   
      every R object is an object (:-) -- and a SEXP internally --
      and we don't use 'fooObject' for other function names even
      though their arguments are R objects....
My taste would rather lead to something like
 'displayStructure' (or 'dissectInternal' ;-) or a shorter
version of those.

    >> The very few cases I found it was insufficient,
    >> certainly  dput()  was, possibly even using it as
    >> dput(. , control = ....).

    Gabriel> As I wrote in my email, I might have reinvented
    Gabriel> the wheel. I did not know str! 

(amazingly ... ;-)

    Gabriel> The output of str and print.object is quite similar
    Gabriel> for atomic and list objects. I might look at this
    Gabriel> function to change the argument names of the
    Gabriel> print.object function.

    Gabriel> However, the output of str is quite different
    Gabriel> for language expressions and does not show as well
    Gabriel> the their list-like strcuture since it respects
    Gabriel> the superficial C-like syntax of the R language
    Gabriel> (at the textual level).

Ok, thanks for clarifying this aspect, and the difference to
both str() and dput() here.

    <.... much omitted ...>

Martin Maechler,
ETH Zurich

More information about the R-devel mailing list