From ellis at stat.harvard.edu  Fri Mar 25 11:09:15 2005
From: ellis at stat.harvard.edu (Byron Ellis)
Date: Fri Mar 25 11:09:36 2005
Subject: [Rd] can R_do_slot_assign change slot type
In-Reply-To: <C698D707214E6F4AB39AB7096C3DE5A58FF619@phost015.EVAFUNDS.intermedia.net>
References: <C698D707214E6F4AB39AB7096C3DE5A58FF619@phost015.EVAFUNDS.intermedia.net>
Message-ID: <06a58b9399199d7a130b5d6f5b92bd9b@stat.harvard.edu>

I've done this by accident before and it works, but causes trouble down 
the line (IIRC saving and loading objects causes problems).

On Mar 21, 2005, at 10:22 PM, Vadim Ogranovich wrote:

> Hi,
>
> It seems that R_do_slot_assign can change the type of an S4 class slot.
> For example I have a class
>
> setClass("ostream", representation(id = "integer", keepOpen =
> "logical"))
>
> and inside a C-function I was able to assign a RAW vector to the id
> slot. Is this intentional? I remember reading somewhere that the slot
> type is guaranteed by R. Maybe this doesn't extend to C code?
>
>
> Now, in the above example I actually don't know the eventual type of 
> the
> 'id' slot, it will be set up in some C code that intializes the class
> instance. What is the right way to define the representation in such a
> case?
>
> Thanks,
> Vadim
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
---
Byron Ellis (ellis@stat.harvard.edu)
"Oook" -- The Librarian


[Rd] can R_do_slot_assign change slot type
Byron Ellis