From murdoch at stats.uwo.ca  Mon Apr 18 11:02:41 2005
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon Apr 18 12:02:35 2005
Subject: [Rd] RE: A 'true' R-wrapper for C++ classes
In-Reply-To: <BAY17-F344E23FE86622C7C9FD4DBD1290@phx.gbl>
References: <BAY17-F344E23FE86622C7C9FD4DBD1290@phx.gbl>
Message-ID: <41166.130.225.48.22.1113814961.squirrel@www.stats.uwo.ca>

> Sorry about the mistake in the previous post, here is the corrected
> version:

And I've just added responses to part of it:


> (3) The above model lacks something like an 'environment' for the pointer
> to
> the C++ object to live in it. Assume we create the foo class in R like:
>
>   obj <- foo$new()
>
> Now, the following would return an error:
>
>   obj$fun()
>
> and the reason is that the pointer created in the initialize method is
> lost.
>
> (4) The question is how to assign an environment to the pointers. A well
> described answer, rather than some abstract hints, is well-appreciated.

I think you'll have to ask the OOP author this one.  Generally R doesn't
have pointers, so when a package provides them, it needs to do a lot of
low level support for them.

> Also
> I am curious to know why there is no standard method for R to wrap C++
> classes, something like JNI.

I think it would be harder to write such a thing, in that R and C++ are
more different than Java and C++ are.

Duncan Murdoch


[Rd] RE: A 'true' R-wrapper for C++ classes
Duncan Murdoch