Re: [Rd] formals(x)<- drops attributes including class

2016-03-13 Thread Duncan Murdoch
On 13/03/2016 9:54 AM, Henrik Bengtsson wrote: Just checking in to see whether it is intended or not that assigning new formals to a function/closure causes any attributes to be dropped: For srcref, yes. Changing the formals or body of a function would usually make them invalid. I think it

[Rd] formals(x)<- drops attributes including class

2016-03-13 Thread Henrik Bengtsson
Just checking in to see whether it is intended or not that assigning new formals to a function/closure causes any attributes to be dropped: EXAMPLE: > fcn <- structure(function() {}, foo="foo", class=c("foo")) > str(fcn) function () - attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 18 1 30 18