[Rd] Limitations of generic functions

Ali - saveez at hotmail.com
Thu Apr 21 11:44:34 CEST 2005


(1) Assume we have some automatic C++ wrapper which , briefly, reads the C++ 
files and generates some R files in which the equivalent of the C++ classes 
are reconstructed.

(2) As the OO design of R is different to that of C++, some isses exist when 
creating an interface between these two systems. (I said these two are 
'different', I didn't say which one is better or which one is uglier. So 
please save the posts on criticising the designs for somewhere else. I am 
trying to make these two designs talk to each other without judging them.)

(3) One of these issues is about handling overloaded member functions in C++ 
in the form of R classes. Following the discussion followed by my previous 
post, I have decided to wrap the C++ in the form of S4 classes.

(4) Some more assumptions:

    (a) A C++ class may have any arbitrary number of overloaded functions 
each of them have some arbitrary number of arguments.

    (b) To create the equivalent 'overloaded functions' in R, we need to 
have a generic function with several methods. The arguments (signature) of 
each of these methods are determined by the generic function.
    (c) In order to make the automatic wrapper as general as possible, it 
should not know about the arguments of the overloaded functions.

(5) And finally the question: How to define the generic function so that it 
covers any unknown arguments of its methods? Apparently simply using '...' 
does not work.



More information about the R-devel mailing list