Re: [Rd] initFields() method no longer coerces arguments in R-devel

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Fri, 05 Aug 2011 10:24:51 -0400

It's worth actually reading the list you post to ... http://r.789695.n4.nabble.com/Reference-classes-assignments-to-fields-td3708168.html

On Aug 5, 2011, at 6:41 AM, Jon Clayden wrote:

> Dear all,
>
> I've just had a package update bounced from CRAN because of a recent
> change in R-devel which seems to affect the behaviour of the
> initFields() reference class method. (The change must be very recent
> because I tested the package on a week-old build of R-devel.) It seems
> that the method no longer coerces its arguments to the expected type
> of each field. For a simple example:
>

>> Foo <- setRefClass("Foo", fields=list(number="integer"), methods=list(initialize=function (number = NULL) initFields(number=number)))
>> Foo$new()

> Error in function (value) :
> invalid replacement for field ‘number’, should be from class
> “integer” or a subclass (was class “NULL”)
>
> (This used to work, with "number" being set to "integer(0)"). In fact
> it is now extremely strict, not even allowing a double literal which
> is equal to an integer:
>
>> Foo$new(number=1)

> Error in function (value) :
> invalid replacement for field ‘number’, should be from class
> “integer” or a subclass (was class “numeric”)
>
> I don't see anything about this in the NEWS, so I was wondering if I
> could get clarification on whether this is now the intended behaviour,
> before I further modify the package. I must say that this will be a
> bit of a pain to "correct"...
>
> All the best,
> Jon
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 05 Aug 2011 - 14:31:35 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 Fri 05 Aug 2011 - 18:40: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