[Rd] Assignment to a slot in an S4 object in a list seems to violate copy rules?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Sep 30 19:13:16 CEST 2010
On Thu, 30 Sep 2010, Thomas Lumley wrote:
> On Thu, Sep 30, 2010 at 8:15 AM, peter dalgaard <pdalgd at gmail.com> wrote:
>>
>> On Sep 30, 2010, at 16:19 , Niels Richard Hansen wrote:
>>
>>> setClass("A", representation(a = "numeric"))
>>> B <- list()
>>> myA <- new("A", a = 1)
>>> B$otherA <- myA
>>> B$otherA at a <- 2
>>> myA at a
>>
>> R version 2.12.0 Under development (unstable) (2010-09-13 r52905)
>> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
>>
>> --- not anymore, it seems: ---
>>> setClass("A", representation(a = "numeric"))
>> [1] "A"
>>> B <- list()
>>> myA <- new("A", a = 1)
>>> B$otherA <- myA
>>> B$otherA at a <- 2
>>> myA at a
>> [1] 1
>>> sessionInfo()
>> R version 2.12.0 alpha (2010-09-29 r53067)
>> Platform: x86_64-apple-darwin10.4.0 (64-bit)
>>
>> So somewhere in the last 162 commits, this got caught. Probably r52914, but it looks like it hasn't been recored in NEWS (and it should be as this was apparently a live bug, not an obscure corner case):
>>
>> r52914 | luke | 2010-09-15 19:06:13 +0200 (Wed, 15 Sep 2010) | 4 lines
>>
>> Modified applydefine to duplicate if necessary to ensure that the
>> assignment target in calls to assignment functions via the complex
>> assignment mechanism always has NAMED == 1.
>>
>
> Yes, that was the one. It was reported as a bug back then too, and
> there was quite a bit of discussion that ended up with Luke's fix.
There is also a bug fix to that fix a few days later.
>
> -thomas
>
> --
> Thomas Lumley
> Professor of Biostatistics
> University of Washington, Seattle
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list