Displaying 7 results from an estimated 7 matches for "r_has_methods_attached".
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 19
2
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
See also .isMethodsDispatchOn, which is what trace uses to decide if the
methods package needs to be loaded.
~G
On Tue, Apr 19, 2016 at 5:34 AM, Michael Lawrence <lawrence.michael at gene.com
> wrote:
> Not sure why R_has_methods_attached() exists. Maybe Martin could shed
> some light on that.
>
> On Mon, Apr 18, 2016 at 11:50 PM, Kirill M?ller
> <kirill.mueller at ivt.baug.ethz.ch> wrote:
> > Thanks for looking into it, your approach sounds good to me. See also
> > R_has_methods_attached()
> > (...
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 19
4
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
...g attached? I'm not sure implementation-wise how easy this
would be, but it seems like any time there is an S4 object around, the
methods package should be available to deal with it.
~G
On Tue, Apr 19, 2016 at 7:34 AM, Michael Lawrence <lawrence.michael at gene.com
> wrote:
> Right, R_has_methods_attached() uses that. Probably not the right
> check, since it refers to S4 dispatch, while S4_extends() is used by
> S3 dispatch.
>
> Perhaps S4_extends() should force load the methods package? The above
> example works after fixing the check to ensure that R_MethodsNamespace
> is not R_G...
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 19
3
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
Thanks for looking into it, your approach sounds good to me. See also
R_has_methods_attached()
(https://github.com/wch/r-source/blob/42ecf5f492a005f5398cbb4c9becd4aa5af9d05c/src/main/objects.c#L258-L265).
I'm fine with Rscript not loading "methods", as long as everything works
properly with "methods" loaded but not attached.
-Kirill
On 19.04.2016 04:10, Micha...
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 19
0
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
Right, R_has_methods_attached() uses that. Probably not the right
check, since it refers to S4 dispatch, while S4_extends() is used by
S3 dispatch.
Perhaps S4_extends() should force load the methods package? The above
example works after fixing the check to ensure that R_MethodsNamespace
is not R_GlobalEnv, but one could load...
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 19
0
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
...ion-wise how easy this
> would be, but it seems like any time there is an S4 object around, the
> methods package should be available to deal with it.
>
> ~G
>
> On Tue, Apr 19, 2016 at 7:34 AM, Michael Lawrence <lawrence.michael at gene.com
>> wrote:
>
>> Right, R_has_methods_attached() uses that. Probably not the right
>> check, since it refers to S4 dispatch, while S4_extends() is used by
>> S3 dispatch.
>>
>> Perhaps S4_extends() should force load the methods package? The above
>> example works after fixing the check to ensure that R_MethodsNames...
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 19
0
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
Not sure why R_has_methods_attached() exists. Maybe Martin could shed
some light on that.
On Mon, Apr 18, 2016 at 11:50 PM, Kirill M?ller
<kirill.mueller at ivt.baug.ethz.ch> wrote:
> Thanks for looking into it, your approach sounds good to me. See also
> R_has_methods_attached()
> (https://github.com/wch/r-source/blo...
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
2016 Apr 18
3
S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment
Scenario: An S3 method is declared for an S4 base class but called for
an instance of a derived class.
Steps to reproduce:
> Rscript -e "test <- function(x) UseMethod('test', x); test.Matrix <-
function(x) 'Hi'; MatrixDispatchTest::test(Matrix::Matrix())"
Error in UseMethod("test", x) :
no applicable method for 'test' applied to an