[Rd] Possible bug in 'new()' for Reference Classes

From: Janko Thyson <janko.thyson.rstuff_at_googlemail.com>
Date: Wed, 07 Dec 2011 16:36:56 +0100


Dear list,

I think I stumbled across a little bug with respect to the standard initialization routine for Reference Classes.

It seems that a field 'self' is treated as if it's name would be '.self' (which we know is reserved for the self reference of the instantiated object itself) and thus an error is thrown. If the field value is assigned in an explicit call after the instantiation via 'new()', everything works just fine:

setRefClass("ClassInfo",

         fields=list(
             self="character", super="character", sub="character"
         )
     )
     new("ClassInfo", self="B", super="A", sub="C")    # Error

     x <- new("ClassInfo", super="A", sub="C")
     x
     x$self <- "B" # Works
     x

Best regards,
Janko



R-devel_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 07 Dec 2011 - 15:43:30 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 08 Dec 2011 - 02:50:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive