Skip to content
Prev 370091 / 398503 Next

setReplaceMethod creates 'object' in the userworkspace

> Hi,
    > I recognized that the function 'setReplaceMethod' is creating a
    > character vector in the user workspace having the name (e.g. "newClass")
    > of the class used as value. If you can sort out a mistake by myself, I
    > would like you to file a bug report.

Yes, a mistake by yourself (and really not fit for R-devel,
but rather for R-help to which I follow up now)

    > BBFN,
    > Jonathan
Q: what do you think happens with the above [last setReplaceMethod() call] ?
A: it creates an R object named 'object' in the globalenv
   (or the package if this would go into a package)

If just replace  '(object = "newClass")'   by   '"newClass"'
things should be fine.

{{ Removing all the completely redundant return(.), i.e. return
   implicitly rather than via an extra function call would also
   make the code "cleaner" and more R-like  }} 

Best,
Martin