Skip to content
Prev 55238 / 63424 Next

Dispatch mechanism seems to alter object before calling method on it

On 05/16/2018 01:24 PM, Michael Lawrence wrote:
Only as(1:4, "numeric", strict=FALSE) should be a no-op.
as(1:4, "numeric") should still coerce because as() is supposed
to perform strict coercion by default.
as.numeric() is doing the right thing (i.e. strict coercion) so there
is no need to touch it.
So we should add to the list that inherits(data.frame(), "list") is
broken too. Once it gets fixed, is(data.frame(), "list") won't need
to compromise anymore and will be free to return the correct answer.
Yes, I see that R is does not care about inheritance here.
But is that it? Is that the end of the story? 3 different
functions checking 3 different things but isn't the last one
broken?
Hopefully these issues are not officially "closed".

As you know these issues are serious flaws. They've been biting me
and other Bioconductor developers (including you) over and over in
our development effort in S4Vectors and other Bioconductor packages
that heavily rely on the S4 system.

Unfortunately the discussions I've seen about these issues almost
always die under the weight of complex technical considerations
that are almost impossible to understand if one is not familiar
with the internals of the methods package. Very few of us are
(I'm not counting myself). The problem is that this complexity,
or some obscure early design decisions, seems to be used as an
excuse for not fixing these issues. So yes, I'm finding this
situation quite frustrating to be honest, and I'm only expressing
this frustration here. Note that this is not the same as trolling.
Forgive me if it sounded like that.

H.