I didn't find an answer elsewhere:

My package 'bit' creates a S3 generic 'clone' and exports it. Furthermore it registers a S3 method 'clone.default' (not exported).

My package 'ff' imports package 'bit' and exports and registers a new S3 method 'clone.ff'. However, calling 'clone(ffobj)' dispatches to clone.default instead of clone.ff !? Why?

What is the recommended way to create new S3-methods that get dispatched? In earlier versions of the packages I simply exported everything - that worked.

Best


Jens


> require(ff)
>
> a <- as.ff(0:9)
> class(x)
[1] "ff_vector" "ff"
>
> x <- clone(a)
> y <- bit:::clone.default(a)
> z <- clone.ff(a)
>
> # cloned ffobjects should have different filenames>

> filename(a)  # original
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed54cbb5060.ff"
>
> filename(x)  # unexpected equal (dispatch to clone.default)
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed54cbb5060.ff"
>
> filename(y)  # expected equal
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed54cbb5060.ff"
>
> filename(z)  # OK
[1] "/tmp/Rtmpk17JRZ/ff/clone1ed551d3ee66.ff"

> version
               _
platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          4
minor          1.1
year           2021
month          08
day            10
svn rev        80725
language       R
version.string R version 4.1.1 (2021-08-10)
nickname       Kick Things

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to