Re: [Rd] R5 reference classes: how to initialize exactly?

From: Romain Francois <romain_at_r-enthusiasts.com>
Date: Wed, 17 Nov 2010 11:48:42 +0100

Le 17/11/10 11:39, Janko Thyson a écrit :
>
>> -----Ursprüngliche Nachricht-----
>> Von: Simon Urbanek [mailto:simon.urbanek_at_r-project.org]
>> Gesendet: Mittwoch, 17. November 2010 11:35
>> An: Janko Thyson
>> Cc: 'r-devel_at_r-project. org'
>> Betreff: Re: [Rd] R5 reference classes: how to initialize exactly?
>>
>> Just a clarification for posterity - R5 has nothing to do with the new
>> reference classes. It's not even an official name, but informally it's a
>> collection of ideas for an entirely new object system that can replace
>> both S3 and S4 (not that it will but it should be seen as having the
>> capability to do so technically). Reference classes are just an addition
>> to S4.
>>
>> Cheers,
>> Simon
>
> Thanks for that clarification. I picked that name up from the Google
> TechTalks presentation of Dirk and Romain. So I refer to them as S4
> reference classes in future posts?
>
> Regards,
> Janko

Sorry about that. It was meant as a sort of private joke. (we do say in the talk that this is not an official name).

>> On Nov 16, 2010, at 12:30 AM, Janko Thyson wrote:
>>
>>> Sorry, I was stupid:
>>>
>>>
>>>
>>> MyRefObj<- setRefClass("Blabla", .)
>>>
>>>
>>>
>>> One can always get the generator object of an defined class with
>>> 'getRefClass()'. So:
>>>
>>>
>>>
>>> g<- getRefClass("Blabla")
>>>
>>> x<- g$new(.)
>>>
>>>
>>>
>>> Regards,
>>>
>>> Janko
>>>
>>>
>>>
>>>
>>>
>>> Von: Janko Thyson [mailto:janko.thyson_at_ku-eichstaett.de]
>>> Gesendet: Dienstag, 16. November 2010 00:27
>>> An: 'r-devel_at_r-project. org'
>>> Betreff: R5 reference classes: how to initialize exactly?
>>>
>>>
>>>
>>> Dear List,
>>>
>>>
>>>
>>> So far, I really like those new R5 classes. But what kind of puzzles
>> me is
>>> that it's not just enough to define the actual reference class, I also
>> have
>>> to assign it to an object (e.g. 'MyRefObj') in order to fire
>>> 'MyRefObj$new(.)'.
>>>
>>>
>>>
>>> S4:
>>>
>>> setClass("Blabla", .)
>>>
>>> x<- new("Blabla")
>>>
>>>
>>>
>>> R5:
>>>
>>> MyRefObj<- setRefClass("Blabla", .)
>>>
>>> x<- MyRefObj$new(.)
>>>
>>>
>>>
>>> But then how do I define a reference class in a package that should be
>>> available after the package is loaded via 'library(my_pkg)' as there
>> is no
>>> 'MyRefObj' at startup yet? Do I have to call the script where the
>> definition
>>> lives?
>>>
>>>
>>>
>>> Thanks for any comments,
>>>
>>> Janko

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/9VOd3l : ZAT! 2010
|- http://bit.ly/c6DzuX : Impressionnism with R
`- http://bit.ly/czHPM7 : Rcpp Google tech talk on youtube

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 17 Nov 2010 - 11:00:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 17 Nov 2010 - 12:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive