Hi Dirk,<br><br>yes it would, <br><br>1) my_class::my_method delegates to ReferenceClass::my_method  [c++ method exported]<br>2) ReferenceClass(R)::my_method callSuper() --> [ infinite recursion!!! ]<br>3) smoke + possible explosion + ... random events from HR department<br>

<br>or some benefits:<br>1) my_class::my_method delegates to ReferenceClass::my_method<br>2) ReferenceClass(R)::my_method ( works hard to solve some problem )<br>3) abstract class with R reference class impl  <br><br>This is still based on the assumption that one can call a ReferenceClass method... if so this may open up a door to design interfaces in c++ and implementing them in R. With some limitations: my_class::my_method()=0; would need some stub generated and linked to call R reference class. (if that possible at all)<br>

<br>I don't not have the necessary experience to oversee all the implications of a feature/bug outlined; but find it an appealing thought to able to extend a c++ class in R where c++ runtime has the ability to call the R implementation. <br>
<br>[c++ Interface_a]  ---> [c++ Abstract_ab  ] ---> Rcpp_export  -> | R c_runtime | -> [ RrefClass  impl_ab]<br>
[c++ Interface_b]  --|<br><br>[ some infrastructure to process/direct data flow ]        --------------------------------> Â Â Â Â  [ set of implementations to choose from ]<br><br>steve <br><br><div class="gmail_quote">
On Fri, Mar 1, 2013 at 6:35 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Hi Steven,<br>
<div><br>
On 1 March 2013 at 14:34, Steven Varga wrote:<br>
|<br>
| Hello<br>
| Â <br>
| First thanks Dirk for the quick reply and the hint; Mr.  John Chamber's<br>
| implementation is great! gone through the documentation and followed his<br>
| instructions. Worked well.  Only one way though -- as you pointed out.<br>
| Â <br>
| I was able to get the fields from the extended class; if someone could point<br>
| into the direction how to get/execute methods of a Reference Class  then it may<br>
| be doable??<br>
<br>
</div>Just making sure I understand: So you want to access part of a reference<br>
class from C++? Wouldn't that violate the 'one way only view?<br>
<br>
Dirk<br>
<div><div><br>
| Â <br>
| Â ..... c++ class ......<br>
| Â Â Â  void set_reference( SEXP xptr_){<br>
| Â Â Â Â Â Â Â  Rcpp::Reference ref(xptr_);<br>
| Â Â Â Â Â Â Â  ref.field("some_field"));   // get the field data<br>
| Â Â Â Â Â  Â <br>
| // -------  this is not implemented, any hints?  -------- <br>
| Â Â Â Â Â Â Â  ref.method("some_method")( x, y);  // this would be nice to have<br>
| Â Â Â  }<br>
| ...... end .......<br>
| Â <br>
| setRcppClass("World",<br>
| Â Â Â  module="yada",<br>
| Â Â Â  fields = list( some_field = "character"),<br>
| Â Â Â  methods = list(<br>
| Â Â Â Â Â Â Â Â Â  initialize = function(){<br>
| Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  some_field <<- "field value set"<br>
| Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  callSuper()                # call constructor<br>
| Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  set_reference( .self ) # pass 'this'<br>
| Â Â Â Â Â Â Â Â Â  }<br>
| Â Â Â Â  ),saveAs="genWorld"       <br>
| )<br>
|<br>
| On Thu, Feb 28, 2013 at 8:15 AM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>> wrote:<br>
|<br>
| Â  Â  On 28 February 2013 at 04:44, Steven Varga wrote:<br>
| Â  Â  | I am trying to create an abstract pattern using R reference objects in<br>
| Â  Â  C++;<br>
| Â  Â  | anyone knows if this is possible/not possible? Where to look?<br>
|<br>
| Â  Â  I am not sure you can. The best (only ?) relevant documentation might be<br>
| Â  Â  John<br>
| Â  Â  Chamber's example of 'Rcpp Classes' (see help(setRcppClass) in R once Rcpp<br>
| Â  Â  is<br>
| Â  Â  loaded).<br>
|<br>
| Â  Â  And as I recall, he is pretty explicit that you can take a C++ class and<br>
| Â  Â  "extend" it for prototyping from the R side, but that you cannot access<br>
| Â  Â  those<br>
| Â  Â  extended parts from C++ as only R sees it. Â I think you are hitting a<br>
| Â  Â  similar<br>
| Â  Â  constraint here.<br>
|<br>
| Â  Â  It would be nice if this worked but I am not quite sure that it can.<br>
|<br>
| Â  Â  Dirk<br>
|<br>
| Â  Â  --<br>
| Â  Â  Dirk Eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
|<br>
|<br>
|<br>
|<br>
</div></div>| ----------------------------------------------------------------------<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
<div><div>--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</div></div></blockquote></div><br>