Re: [Rd] assignInNamespace and new bindings

From: <>
Date: Tue, 31 May 2011 13:54:38 -0500

On Tue, 31 May 2011, Thomas Friedrichsmeier wrote:

> On Tuesday 31 May 2011, wrote:
>> Also note at the beginning of of th help file:
>> Utility functions to access and replace the non-exported functions
>> in a name space, for use in developing packages with name spaces.
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> This is intended only as a developer convenience, not as something to
>> be used in production code. It is quite deliberate the name spaces are
>> intended to be read-only once created. This allows the compiler to
>> make assumptions about functions/constants defined in a name space.
>> For now the compiler only uses this infomation for the base packages,
>> but that could change in the future.
> Could you elaborate a bit? In RKWard, we do make use of assignInNamespace(),
> mostly in order to insert hooks into functions where there are none by
> default. For example, in order to get correct interleaving of output generated
> by system() commands, and R output, we insert two calls for synchronization
> inside base::system() and base::system2(). As another example, we add some
> code into utils::select.list() to provide our own UI if graphics=TRUE. In
> total, currently, we have around a dozen calls to assignInNamespace(), for
> which I do not see any workable alternative.
> None of these changes the function formals, environment, or type of return
> value. All of this is done only once, at the start of the session. Should I be
> worried that it will still interact badly with the compiler?

Yes you should. Changing things in other people's packages is not a safe thing to do.



> Regards
> Thomas

Luke Tierney
Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:
Iowa City, IA 52242                 WWW:

______________________________________________ mailing list
Received on Tue 31 May 2011 - 18:56:45 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 01 Jun 2011 - 08:00:14 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive