Hi, This works fine and gives 26:
setClass("A", representation(bidule="character")) setMethod("length", "A", function(x) length([EMAIL PROTECTED])) a <- new("A", bidule=letters) str(a) length(a) But if my "length" method is broken, then str() stops working: > setMethod("length", "A", function(x) length([EMAIL PROTECTED])) > str(a) Error in length(object) : no slot of name "bidulle" for this object of class "A" Doesn't seem like a big deal on such a simple example but this can be really problematic. I already had the situation where the "length" method is in fact very complicated, with a lot of nested calls and one access to a database and an error occurring at a deep level. I noticed that my program had a problem but I was not yet aware that "length" was broken. So I started the debug session and tried to use str() to look inside my objects... but str() was not working! Which makes a debugging session with a lot of S4 stuff all around the place quite painful :-/ Cheers, H. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel