From tplate at acm.org  Tue Jun 30 19:26:46 2009
From: tplate at acm.org (Tony Plate)
Date: Tue, 30 Jun 2009 11:26:46 -0600
Subject: [Rd] active bindings and ls.str
In-Reply-To: <200906301351.23177.thomas.friedrichsmeier@ruhr-uni-bochum.de>
References: <4A4932D8.1040501@dbmail.com>	<200906301141.37573.thomas.friedrichsmeier@ruhr-uni-bochum.de>	<4A49E1DA.4060809@dbmail.com>
	<200906301351.23177.thomas.friedrichsmeier@ruhr-uni-bochum.de>
Message-ID: <4A4A4AD6.5060200@acm.org>

Thomas Friedrichsmeier wrote:
> On Tuesday 30 June 2009, Romain Francois wrote:
>   
>> This was more of a question. I'd like to know if there is a way for
>> objects to broadcast that they have changed.
>> This would be very useful to for example implement an object browser in
>> a front-end, which I guess is part of the reason for the trick ?
>>     
>
> Yes, that's around half the reason. The other half is our data.frame-editor, 
> which tries to create the illusion of "in-place" editing. For that it's pretty 
> important to keep the editor data in sync with R's version of the data.frame.
>
> I would certainly like to see an easier way to detect changed objects as well.
>
>   
I used active bindings for the same purpose (tracking changes to 
objects) in the package trackObjs.  Prior to using active bindings, I 
experimented with changes in the C code that added hooks to an 
environment so that an R function could be called when an object in the 
environment was created, changed or deleted.  This code was reasonably 
simple, and I'd be happy to share it if there is any interest (it was 
for R-2.4.1).

-- Tony Plate
>> The problem is as soon as you pass it to a function, you force the
>> promise, maybe passing the symbol instead could do the trick, but I have
>> not seen something that brings the information that an object is a
>> promise. Maybe you are right and I am not supposed to play with them ...
>>     
>
> Yes, passing the symbol does the trick, indeed. (And until a few minutes ago, 
> there was a regression in RKWard in just that respect.) 
>
> I'll have to admit that we do play with the internals of promises in RKWard, 
> too: When the only reason that we forced a promise was that the object browser 
> stepped on it, we "put it back" to free up the memory, again. This works 
> remarkably well, but in fact I don't think we are supposed to do this...
>
> Regards
> Thomas
>   
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] active bindings and ls.str
Tony Plate