This issues a message about a needing to be non-negative as expected: setClass("A", representation = list(a = "numeric"), prototype = list(a = 0), validity = function(object) { out <- if (object@a < 0) "a must be non-negative" if (is.null(out)) TRUE else out ## }) new("A", a = -1)
but it also works if the ## line is omitted so it appears that one can use NULL in place of TRUE. I wonder if the use of NULL as an alternative to TRUE could be officially supported as it would allow one to write validity methods in a more concise manner. It appears that this would only require a change to the documentation. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel