Thanks Johannes,
I was aware of the modules package (it was not suitable for my needs
unfortunately), but I did not know about box… somehow I managed to completely
miss it in my search (embarrassing, really).
My own package offers similar functionality to box, but is designed to closely
fol
> In the end, I wrote a package that implements lightweight python-like
> modules for R and that has really improved my workflow. I hope to publish
> this package later this year after I have cleaned it up a bit.
Hi, are you aware of the previous work in this direction
https://github.com/klmr/box
Taras,
> That was my original plan as well, but managing and deploying dozens
> of little packages that are all under active development is a
> nightmare even with devtools. Just too much overhead, not to mention
> that coming up with names that would not have namespace conflicts was
> getting sill
Hi Greg,
That was my original plan as well, but managing and deploying dozens of little
packages that are all under active development is a nightmare even with
devtools. Just too much overhead, not to mention that coming up with names that
would not have namespace conflicts was getting silly.
Taras,
> P.S. If you are wondering what I am trying to achieve here — we have a
> very large codebase and I am trying to use environments as a type of
> “poor man’s namespaces” to organize code in a modular fashion. But of
> course it’s all pointless if I can’t get the generics to work
> reliably.
I have opened a bug report here:
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=18138
Regarding _R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV_… maybe it’s a good time to
consider purging it alltogether? This behavior appears to be completely
undocumented and this variable is mentioned exactly t
One error in my workaround: it also ignores
_R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV_. If that evaluates to FALSE,
it shouldn't need to make any changes.
Duncan Murdoch
On 30/06/2021 9:20 a.m., Taras Zakharko wrote:
Thanks Duncan, I will submit a bug report to R core then.
Best,
Taras
O
Thanks Duncan, I will submit a bug report to R core then.
Best,
Taras
> On 30 Jun 2021, at 14:16, Duncan Murdoch wrote:
>
> On 30/06/2021 7:37 a.m., Taras Zakharko wrote:
>> Thats not how I read the code? Consider this snippet from registerS3method:
>> genfun <- get(genname, envir = envir)
>
On 30/06/2021 7:37 a.m., Taras Zakharko wrote:
Thats not how I read the code? Consider this snippet from registerS3method:
genfun <- get(genname, envir = envir)
if (.isMethodsDispatchOn() && methods::is(genfun, "genericFunction"))
genfun <- methods::finalDefaultMethod(genfu
Thats not how I read the code? Consider this snippet from registerS3method:
genfun <- get(genname, envir = envir)
if (.isMethodsDispatchOn() && methods::is(genfun, "genericFunction"))
genfun <- methods::finalDefaultMethod(genfun@default)
if (typeof(genfun) == "closure"
On 30/06/2021 7:23 a.m., Taras Zakharko wrote:
I had another glance at the code and now I’m convinced that this is the bug in
registerS3method(). Default R behavior (in objects.c) appears to be to look for
method definitions in the top environment, not the defining environment, but
registerS3m
On 30/06/2021 6:51 a.m., Taras Zakharko wrote:
@Duncan: .S3method() calls registerS3method() with appropriate environmental
argument under the good, so that’s not the problem.
Anyway, I’ve been doing some debugging and I think I have found the issue. The
following snippet in src/objects.c
(ht
I had another glance at the code and now I’m convinced that this is the bug in
registerS3method(). Default R behavior (in objects.c) appears to be to look for
method definitions in the top environment, not the defining environment, but
registerS3method() registers the method in the defining envi
@Duncan: .S3method() calls registerS3method() with appropriate environmental
argument under the good, so that’s not the problem.
Anyway, I’ve been doing some debugging and I think I have found the issue. The
following snippet in src/objects.c
(https://github.com/wch/r-source/blob/ecc633b37d77f
On Wed, Jun 30, 2021 at 5:17 AM Duncan Murdoch wrote:
>
> On 30/06/2021 5:22 a.m., Taras Zakharko wrote:
> > Dear all,
> >
> > I have a generic function and a bunch of methods defined in a separate
> > environment. Here is a reduced example:
> >
> > env <- local({
> > # define the gener
On 30/06/2021 5:22 a.m., Taras Zakharko wrote:
Dear all,
I have a generic function and a bunch of methods defined in a separate
environment. Here is a reduced example:
env <- local({
# define the generic function and the method
myfun <- function(x) UseMethod("myfun")
myfu
16 matches
Mail list logo