[Rd] validity testing as part of '@<-'

From: Parlamis Franklin <fparlamis_at_mac.com>
Date: Thu 21 Sep 2006 - 21:29:38 GMT


'methods' package feature request / discussion starter:

perhaps a call to 'validObject' should occur at part of any slot replacement operation (and the operation not be carried out if it would invalidate the object)? this may prevent the need for prophylactic 'validObject' calls in other user-defined functions. in the example below, the slot assignment occurs even though it invalidates the object. the 'show' method then fails somewhat deep in a subsequently-called coercion method.

library(Matrix)
test <- Matrix(1:4+0.1, nrow = 2, dimnames = list(letters[1:2], LETTERS[1:2]))
test@Dimnames <- list(1:100)
test

direct slot access (without a validity check) seems an easily accessible loophole to S4 object "guarantees".

franklin parlamis



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Sep 22 08:08:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 21 Sep 2006 - 23:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.