On 1/23/2009 1:47 PM, Yi Zhang wrote:
On Fri, Jan 23, 2009 at 5:15 AM, Patrick Burns <pbu...@pburns.seanet.com> wrote:
If I understand properly, you want '<-' to be
a generic function, which it currently isn't.
There may be a way to fake that (I can't think
of any).
But I'm wondering if you should rethink what
you want. The only reason that I can think of
that you would want to change '<-' is because
of some extra side effect that you want to happen.
That is not in the spirit of R.
Yes, I wanted some side effect of '<-', to have my own reference
counting for some large resource. I guess this is already the most
non-intrusive way I can think of--initially I modified R's source
code, an even worse option.
External pointers are the standard way to do that. You don't need to
worry about reference counting, R's garbage collector will call a
finalizer when it doesn't need the object any more.
I think the usual example of this is the RODBC package, which maintains
database connections that way.
If it and the Writing R Extensions manual aren't enough docs for you,
you should probably move the question to the R-devel list: this is
pretty technical for R-help.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.