[Rd] What does is() mean?
Roger Koenker
roger at ysidro.econ.uiuc.edu
Mon Mar 17 04:28:46 MET 2003
Suppose you have a class, say sex, for lack of a better example, and
you are tempted, in defining the behavior of the call,
is(x,"sex")
to check whether certain basic features are satisfied, not to just trust the claim
that x is specified to be of class "sex". `Without delving into details
further sanity checking of the structure of the object is sometimes prudent to
avoid subsequent nonsense. This checking could be built into the is method,
but the documentation for "new" suggests that one might alternatively want to
define a method, "initialize" that was used to create objects of class "sex"
and not let people just create such objects willy-nilly. My questions are these:
1. Am I correct in thinking that initialize is the right way to handle this?
2. Are there examples of the initialize strategy, beyond the one given in
the "new" documentation?
3. Are there efficiency issues that one should be cautious about?
4. Is there any way to enforce the Foucaultian imperative that any new
"sex" object has to pass through the initialize phase?
Oh, for those simple days of yesteryore when the pecadillos of the president
caused no harm, and the Dow was over 10,000...
Apologies in advance if this moment of sexistential doubt offends anyone.
url: www.econ.uiuc.edu Roger Koenker Dept. of Economics UCL,
email rkoenker at uiuc.edu Department of Economics Drayton House,
vox: 217-333-4558 University of Illinois 30 Gorden St,
fax: 217-244-6678 Champaign, IL 61820 London,WC1H 0AX, UK
vox: 020-7679-5838
More information about the R-devel
mailing list