From Robert.McGehee at geodecapital.com  Mon Oct 27 17:22:17 2008
From: Robert.McGehee at geodecapital.com (McGehee, Robert)
Date: Mon, 27 Oct 2008 12:22:17 -0400
Subject: [Rd] S4 object does not commute?
Message-ID: <EEBC169715EB8C438D3C9283AF0F201C03D0BF61@MSGBOSCLM2WIN.DMN1.FMR.COM>

Hello all,
It appears that for the simplest of S4 objects, z+1 does not equal 1+z.
Presumably this is a bug, as 1+z seems to make a malformed object (at
least malformed as an input to str).
Thanks, Robert


> setClass("test", representation("vector"))
[1] "test"
> z <- new("test", 1)
> identical(z+1, 1+z)
[1] FALSE
> str(z+1)
Formal class 'test' [package ".GlobalEnv"] with 1 slots
  ..@ .Data: num 2
> str(1+z)
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Class 'test' Class 'test' Class 'test' Class
'test' Class 'test' Class 'test' Class 'test' Class 'test' Class 'test'
Class 'test' Class 'test' Error: evaluation nested too deeply: infinite
recursion / options(expressions=)?

> R.version
               _                           
platform       x86_64-unknown-linux-gnu    
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          2                           
minor          8.0                         
year           2008                        
month          10                          
day            20                          
svn rev        46754                       
language       R                           
version.string R version 2.8.0 (2008-10-20)



[Rd] S4 object does not commute?
McGehee, Robert