Re: Bug report for sealClass() in Core-maintained package "methods"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Bug report for sealClass() in Core-maintained package "methods"

Gower, Adam
Hello,
I was just reminded from a comment in some code that I had submitted this bug report last year, but it does not appear to have been addressed in R 3.5.0.
Can this please be fixed, or is there a specific reason that it cannot be addressed?
Thanks,
Adam

From: Gower, Adam
Sent: Monday, June 19, 2017 11:56 AM
To: '[hidden email]'
Subject: Bug report for sealClass() in Core-maintained package "methods"

Hello,

I have found that I cannot use sealClass() without specifying the 'where' argument.
I have found this issue in R 3.2.3 and R 3.4.0.
For example:
> setClass("foo", slots=c(name="character", age="integer"))
> isSealedClass("foo")
[1] FALSE
> sealClass("foo")
Error in list2env(list(<environment>), NULL, <environment>) :
  names(x) must be a character vector of the same length as x
> isSealedClass("foo")
[1] FALSE
> sealClass("foo", where=.GlobalEnv)
> isSealedClass("foo")
[1] TRUE

I found that this is because sealClass() includes the following line:
if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)

Because findClass() always returns a list (even if argument 'unique' contains a character string), this assigns a list of length 1 to variable 'where'.
This then throws an error in the subsequent line
assignClassDef(Class, classDef, where)

For this reason, the abovementioned line should instead read:
if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)[[1]]

Thanks very much,
Adam Gower
[hidden email]<mailto:[hidden email]>


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bug report for sealClass() in Core-maintained package "methods"

Duncan Murdoch-2
On 26/10/2018 10:28 AM, Gower, Adam wrote:
> Hello,
> I was just reminded from a comment in some code that I had submitted this bug report last year, but it does not appear to have been addressed in R 3.5.0.
> Can this please be fixed, or is there a specific reason that it cannot be addressed?

You're reporting in the wrong place.  Write to R-devel about
inconsequential things like typos in help pages, or when you're not sure
something is a bug.  Put bug reports that you care about on the bug
reporting site, bugs.r-project.org.

The https://www.r-project.org/bugs.html page suggests that reports here
are sufficient, but it's wrong.  Usually they are not.

Duncan Murdoch

> Thanks,
> Adam
>
> From: Gower, Adam
> Sent: Monday, June 19, 2017 11:56 AM
> To: '[hidden email]'
> Subject: Bug report for sealClass() in Core-maintained package "methods"
>
> Hello,
>
> I have found that I cannot use sealClass() without specifying the 'where' argument.
> I have found this issue in R 3.2.3 and R 3.4.0.
> For example:
>> setClass("foo", slots=c(name="character", age="integer"))
>> isSealedClass("foo")
> [1] FALSE
>> sealClass("foo")
> Error in list2env(list(<environment>), NULL, <environment>) :
>    names(x) must be a character vector of the same length as x
>> isSealedClass("foo")
> [1] FALSE
>> sealClass("foo", where=.GlobalEnv)
>> isSealedClass("foo")
> [1] TRUE
>
> I found that this is because sealClass() includes the following line:
> if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)
>
> Because findClass() always returns a list (even if argument 'unique' contains a character string), this assigns a list of length 1 to variable 'where'.
> This then throws an error in the subsequent line
> assignClassDef(Class, classDef, where)
>
> For this reason, the abovementioned line should instead read:
> if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)[[1]]
>
> Thanks very much,
> Adam Gower
> [hidden email]<mailto:[hidden email]>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bug report for sealClass() in Core-maintained package "methods"

Gower, Adam
Thanks very much for the clarification, Duncan - I appreciate it.  Will do.
Best,
Adam

-----Original Message-----
From: Duncan Murdoch [mailto:[hidden email]]
Sent: Friday, October 26, 2018 9:30 PM
To: Gower, Adam; [hidden email]
Subject: Re: [Rd] Bug report for sealClass() in Core-maintained package "methods"

On 26/10/2018 10:28 AM, Gower, Adam wrote:
> Hello,
> I was just reminded from a comment in some code that I had submitted this bug report last year, but it does not appear to have been addressed in R 3.5.0.
> Can this please be fixed, or is there a specific reason that it cannot be addressed?

You're reporting in the wrong place.  Write to R-devel about
inconsequential things like typos in help pages, or when you're not sure
something is a bug.  Put bug reports that you care about on the bug
reporting site, bugs.r-project.org.

The https://www.r-project.org/bugs.html page suggests that reports here
are sufficient, but it's wrong.  Usually they are not.

Duncan Murdoch

> Thanks,
> Adam
>
> From: Gower, Adam
> Sent: Monday, June 19, 2017 11:56 AM
> To: '[hidden email]'
> Subject: Bug report for sealClass() in Core-maintained package "methods"
>
> Hello,
>
> I have found that I cannot use sealClass() without specifying the 'where' argument.
> I have found this issue in R 3.2.3 and R 3.4.0.
> For example:
>> setClass("foo", slots=c(name="character", age="integer"))
>> isSealedClass("foo")
> [1] FALSE
>> sealClass("foo")
> Error in list2env(list(<environment>), NULL, <environment>) :
>    names(x) must be a character vector of the same length as x
>> isSealedClass("foo")
> [1] FALSE
>> sealClass("foo", where=.GlobalEnv)
>> isSealedClass("foo")
> [1] TRUE
>
> I found that this is because sealClass() includes the following line:
> if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)
>
> Because findClass() always returns a list (even if argument 'unique' contains a character string), this assigns a list of length 1 to variable 'where'.
> This then throws an error in the subsequent line
> assignClassDef(Class, classDef, where)
>
> For this reason, the abovementioned line should instead read:
> if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)[[1]]
>
> Thanks very much,
> Adam Gower
> [hidden email]<mailto:[hidden email]>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel