Seth Falcon wrote:

>On  3 Jan 2006, [EMAIL PROTECTED] wrote:
>  
>
>>It's legal to have virtual classes as slots, but yes, the slot is
>>NULL in the prototype for the new class, unless the user specifies a
>>value.  In your case, providing a non-null prototype for the
>>data.frame slot might be the desired solution.
>>    
>>
>
>Yes, that's a workaround.  
>
>  
>
>>There is no S4 "initialization" for S3 classes; in fact, it's
>>generally an error to use new() on them (or on other virtual
>>classes).
>>    
>>
>
>The "basic vector classes" (see man page for new) can be created
>with new().  From my perspective it would be more consistent if
>data.frame and factor behaved similarly.  
>  
>
The basic classes are set up specially, as "real" S4 classes.  In a 
sense, it would be more consistent NOT to do this & have them be S3 
classes as well, but I assume you're not suggesting that ;-)

The reason that S3 classes are generally virtual is simple:  there is no 
metadata information to tell the system anything at all about the 
objects from the class, and in particular what a prototype object would 
be.  Therefore, new() doesn't know what to return.

In a future version, we could augment setOldClass() to provide such 
information, but it remains true that some S3 classes don't behave like 
legal S4 classes (e.g., different objects from the class can have 
different "slots").

>I admit that I don't understand why data.frame and factor are virtual
>classes and don't know what would be involved to have new() work for
>data.frame and factor.
>
>+ seth
>
>______________________________________________
>R-devel@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel
>
>  
>

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to