On Sat, Jun 3, 2023 at 11:51 AM Mikael Jagan <jagan...@gmail.com> wrote:

> The formals of the newly generic 'qr.X' are inherited from the non-generic
> function in the base namespace.  Notably, the inherited default value of
> formal argument 'ncol' relies on lazy evaluation:
>
>      > formals(qr.X)[["ncol"]]
>      if (complete) nrow(R) else min(dim(R))
>
> where 'R' must be defined in the body of any method that might evaluate
> 'ncol'.
>

Perhaps I am misunderstanding something, but I think Mikael's expectations
about the scoping rules of R are wrong.  The enclosing environment of ncol
is where it was _defined_ not where it is _called_ (apologies if I am
messing up the computer science terminology here).

This suggests to me that codetools is right.  But a more extended example
would be useful. Perhaps there is something special with setOldClass()
which I am no aware of.

Also, Bioconductor has 100s of packages with S4 where codetools works well.

Kasper

        [[alternative HTML version deleted]]

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

Reply via email to