[Rd] Regarding the recent changes to @<-

John Chambers jmc at r-project.org
Mon Jan 14 22:18:26 CET 2013


My guess is that the distinction here is between `@<-` and `slot<-`.

The first, but not the second, has been converted to a primitive (the second has an optional argument, making it more of a nuisance to implement.)

Previously they did the same check; after the revision of `@<-` they did not; after a (fairly soon) new revision they will again.

John

On Jan 14, 2013, at 10:59 AM, François Michonneau wrote:

> Hello Martin,
> 
>  Below is a reduced version of our code that doesn't produce an error in
> r61643 but does in 2.15.2.
> 
>  Thanks,
>  -- François
> 
> setClass("phylo4",
>         representation(edge="matrix",
>                        annote="list"),
>         prototype = list(edge = matrix(nrow = 0, ncol = 2),
>                        annote = list())
> )
> 
> setGeneric("phylo4", function(x, ...) { standardGeneric("phylo4")} )
> 
> setMethod("phylo4", "matrix",
>    function(x, annote = list()) {
>    res <- new("phylo4")
>        res at edge <- x
>        res at annote <- annote
>        res
>    }
> )
> 
> edge <- structure(c(6L, 7L, 8L, 8L, 9L, 9L, 7L, 6L, 7L, 8L, 1L, 9L,
>      2L, 3L, 4L, 5L), .Dim = c(8, 2))
> phylo4(edge, annote="foo")
> 
> 
> 
> 
> On Mon, Jan 14, 2013 at 1:39 PM, Martin Maechler <maechler at stat.math.ethz.ch
>> wrote:
> 
>> phylo4 <- setClass("phylo4",
>>         representation(edge = "matrix",
>>                        edge.length = "numeric",
>>                        label = "character",
>>                        edge.label = "character",
>>                        order = "character",
>>                        annote = "list"),
>>         prototype = list(edge = matrix(nrow = 0, ncol = 2,
>>                                        dimnames = list(NULL,
>>                                        c("ancestor", "descendant"))),
>>                          edge.length = numeric(0),
>>                          label = character(0),
>>                          edge.label = character(0),
>>                          order = "unknown",
>>                          annote = list()
>>         )
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list