From thomas.friedrichsmeier at ruhr-uni-bochum.de  Tue May 31 22:11:37 2011
From: thomas.friedrichsmeier at ruhr-uni-bochum.de (Thomas Friedrichsmeier)
Date: 31 May 2011 22:11:37 +0200
Subject: [Rd] assignInNamespace and new bindings
In-Reply-To: <74462CF4-AE5B-4034-BF2A-1B98734B4BB5@r-project.org>
References: <4DE4A82E.7060803@r-enthusiasts.com>
	<201105312016.44472.thomas.friedrichsmeier@ruhr-uni-bochum.de>
	<74462CF4-AE5B-4034-BF2A-1B98734B4BB5@r-project.org>
Message-ID: <201105312211.41716.thomas.friedrichsmeier@ruhr-uni-bochum.de>

On Tuesday 31 May 2011, Simon Urbanek wrote:
> I would expect so, but I'll let Luke comment on it. It is definitely a very
> bad idea.
> 
> R provides facilities for customization and other GUIs are using them
> properly. If you are lacking anything, I would suggest asking here first -
> it is much easier to add a useful customization path to R than to deal
> with hacks that are fragile due to unjustified assumptions.

I am not entirely convinced that this assessment of the relative difficulty of 
these options is also true for developers outside the R core group.

But, here's my list of requirements. I know that some of these have been 
requested on r-devel before. I'd appreciate, if you can help me with at least 
some:

- utils::loadhistory(), utils::savehistory(), utils::timestamp(): I am not 
using, and can not use readline history. prt_R_loadHistory, ptr_R_savehistory, 
and ptr_R_addhistory are not available on Windows. And they could do with a 
bit more documentation, if GUIs are expected to use these. I need a way to 
interface with my GUIs history mechanism, cross-platform.

- utils::select.list() and utils::menu(): I want to show my own UI if 
graphics==TRUE. Currently, select.list() has special code for windows, "aqua" 
and tcltk; menu() essentially assumes the same code. Give me a way to run 
register my own UI.

- base::system(), base::system2(): As you will be aware, capturing the output 
of system commands in a GUI is tricky on Unix. I do have a solution for that, 
but I need to run synchronization code at the start and end of system() and 
system2(), in order to get interleaving right. Give me a hook, each, at the 
start and end of these functions.

- graphics::plot.new(): I need a hook *before* the new plot is started, in 
order to properly implement device-independent plot history. I would 
appreciate not having to implement my own graphics device just to be able to 
run some code at this point.

- grDevices::dev.off(): I need a hook before the device is closed. Also for 
plot history.

- grDevices::dev.set(): I need a hook after the new device has been set. Also 
for plot history.

- grid::newpage(): See graphics::plot.new(). Of course, even better, I would 
like to have a hook that is called every time before a new page / frame is 
started on a device.

> As a user, I'm
> really worried about packages modifying other packages behind my back (but
> I may be more paranoid than others).

On the level of plain R code: I am very certain that the customizations that I 
am doing are perfectly harmless, because it's pretty trivial stuff. You don't 
have to trust me on that. And of course not any more than you trust the rest 
of any other person's work, in the first place.

Of course, if what I am doing is "illegal" because it steps on the compiler's 
turf, then my assumptions do not hold, indeed. That's what I'm worried about.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20110531/fc8ddadf/attachment.bin>


[Rd] assignInNamespace and new bindings
Thomas Friedrichsmeier