Re: [R] Validity check when setting slot

2009-08-14 Thread Renaud Gaujoux
It looks like a sound solution. Thanks Vitalie. Vitalie S. wrote: Hi, RG> Hi, RG> I'm wondering if the following behaviour is normal: RG> setClass('A', representation(number='numeric'), RG> validity=function(object){ RG> if( obj...@number < -1 ) return("Invalid number")

Re: [R] Validity check when setting slot

2009-08-13 Thread Vitalie S.
Hi, RG> Hi, RG> I'm wondering if the following behaviour is normal: RG> setClass('A', representation(number='numeric'), RG> validity=function(object){ RG> if( obj...@number < -1 ) return("Invalid number"); TRUE}) >> [1] "A" RG> a <- new('A') RG> a >> An

Re: [R] Validity check when setting slot

2009-08-10 Thread Renaud Gaujoux
Hi Martin, Indeed the validObject works, but I was expecting it to be called automatically after a slot assignment. I understand the fact that during their construction, objects' slots are sometime not valid, and thought the check=FALSE was there for such cases. My validity method needs to ch

Re: [R] Validity check when setting slot

2009-08-10 Thread Martin Maechler
> "RG" == Renaud Gaujoux > on Mon, 10 Aug 2009 17:19:12 +0200 (SAST) writes: RG> Hi, RG> I'm wondering if the following behaviour is normal: RG> setClass('A', representation(number='numeric'), RG> validity=function(object){ RG> if( obj...@number < -1 ) return("I