Skip to content
Prev 43437 / 398506 Next

Object validation and formal classes

It was never the intention that validity checking happen automatically 
on _every_ assignment of an object from the class--since those 
assignments take place frequently during evaluation of functions, the 
overhead would be unacceptable.  And as Robert points out, one needs to 
postpone validity checking until a set of mutually dependent changes is 
finished.

The "Programming with Data" description says that validity checking 
takes place on "permanent assignment".  But this was not written with R 
in mind, and the idea of permanent assignment is ambiguous in R.  It 
could mean all assignments into the Global environment, or it could mean 
on serializing (saving the workspace, e.g.).  If we agree on a useful 
interpretation, automatic validity checking might be reasonable in that 
sense in the future.
Torsten Steuernagel wrote: