Closed stefanfritsch closed 9 years ago
I think this is just
args(Person$public_methods$initialize)
#> function (name, hair)
#> NULL
but it might depend on whether you use portable classes or not.
Thanks a lot, I didn't know that.
I'd still like the print function; but as it's really a minor issue for an obscure use case I'll close this.
@gaborcsardi's answer is good. You can also use formals()
if you need to handle the args programatically:
> str(formals(Person$public_methods$initialize))
Dotted pair list of 2
$ name: symbol
$ hair: symbol
Hi,
is there already a way to get the signature of the constructor?
I.e. I want to get
function(name, hair)
from the object generatorPerson
(standard example, see below), something likeargs(Person)
. Or have the print function print the signatures of functions instead of just the type.I could use
Person$new(...)$initialize
but that only works if I already know enough about the constructor to get an object.In my case I wanted the signature of
Progress
in Shiny, which needs a session object so I'd have to render the output, etc., etc. I'm aware that this is only an issue if the documentation something is lacking but it would be nice to have. :)Thx, Stefan