[R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Dear R gurus, I am trying to create a nicer API interface for some R modules I have written. Here, I heavily rely on S3 method dispatch mechanics and makeActiveBinding() function I have discovered that I apparently can't dispatch on function call operator (). While .Primitive(() exists,

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Duncan Murdoch
On 11-01-13 3:09 AM, Taras Zakharko wrote: Dear R gurus, I am trying to create a nicer API interface for some R modules I have written. Here, I heavily rely on S3 method dispatch mechanics and makeActiveBinding() function I have discovered that I apparently can't dispatch on function

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Prof Brian Ripley
The details here are much more appropriate for R-devel, but please check the help pages for ( and [, and note - [ is generic and ( is not. - the primitive `(` is used to implement constructions such as (x - pi) and not x(...). The special handling of operators such as [ is part of the parser,

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Thank you both for very helpful answers. I have indeed missed the help pages about ( and now the situation is more clear. You can use this syntax by defining a function `x-` - function(...) {} and it could be an S3 method, but it is a completely separate object from x. Unfortunately, it

[R] Method dispatch for function

2009-11-18 Thread Stavros Macrakis
How can I determine what S3 method will be called for a particular first-argument class? I was imagining something like functionDispatch('str','numeric') = utils:::str.default , but I can't find anything like this. For that matter, I was wondering if anyone had written a version of `methods`