[ESS] r-related question: editing NAMESPACEd functions in packages

Martin Maechler maechler at stat.math.ethz.ch
Sat Nov 19 20:08:41 CET 2011


>>>>> Vitalie Spinu <spinuvit at gmail.com>
>>>>>     on Fri, 18 Nov 2011 21:30:14 +0100 writes:

    > On 17 November 2011 21:44, Martin Maechler
    > <maechler at stat.math.ethz.ch> wrote:
    >> On Wed, Nov 16, 2011 at 15:53, Stephen Eglen
    >> <S.J.Eglen at damtp.cam.ac.uk> wrote:
    >>> Thanks for adding this Vitalie.
    >>> 
    >>>> In develper mode `ess-eval-function' (and frends)
    >>>> checks if the function name could be found in the
    >>>> `ess-developer-packages'.  If so, it assigns the
    >>>> function into the namespace using
    >>>> 'assignInNamespace()'.  "C-M-d t" to toggle developer
    >>>> mode "C-M-d a" to add a package to your development
    >>>> list (with C-u - remove) "C-M-d r" to remove a package
    >>>> to your development list
    >> 
    >> well, guys,  I'm too busy to bring this up with my R core
    >> mates just now....  but note that the NEWS.Rd for
    >>  R-devel (2.15.0 to be) contains  for a few weeks now
    >> 
    >>    o assignInNamespace() has further restrictions on use
    >> apart from at      top-level, as its help page has
    >> warned.  Expect it to be disabled      from programmatic
    >> use in the future.
    >> 

> Bad news, we are running out of options. There is insertSource in
>     > "methods" package which is intended to source all the
>     > functions and methods into the namespace. I've implemented
>     > the interface to it (bound to C-c C-l and C-M-d s when
>     > ess-developer is active), but insertSource is not
> working.
Hmm, but I had mentioned my own method of working here, namely

     attach(asNamespace(..))
and putting the changed objects into globalEnv().

That would not need any assignInNamespace(), and seems
nicer (cleaner from an R point of view) to me.

But my real point was that you (the ESS-helper community who
would like a reasonable "developer-mode"),
should start discussing the R part of it on R-devel (the mailing list).

That is the dedicated list about future development of R,
enhancement proposals, etc etc.
So the question _there_ should be (something like)

   How are package authors supposed to develop their own
   NAMESPACEd packages efficiently, particularly in the light
   that the use of assignInNamespace() seems to be frowned on ?

Martin

> 
>     > I am getting :
> 
>     > Error in assign(this, thisObj, envir = envwhere) : cannot
>     > add bindings to a locked environment
> 
>     > and there is no function to unlock the environment.
>     > Really not getting it, is that a bug or intended behavior?
>     > Or may be a joke?
> 
>     > Vitalie.
> 
> 
>     >> which seems a bit severe .. and I think quite a bit
>     >> adverse to our new developer mode..
>     --> This is a topic to be discussed on the R-devel mailing
>     --> list
>     >> (same address/URL as 'ess-help', just use 'r-devel'
>     >> instead).
>     >> 
>     >> Martin
>     >> 
>     >> 
>     >> 
>     >> 
>     >>> I would prefer telling .emacs which packages I am a
>     >>> developer of -- is that possible?  Can I just
>     >>> ess-developer-packages myself?
>     >>> 
>     >>> It may also be a wording issue, but you say
>     >>> 
>     >>>> if the function name could be found in the
>     >>>> `ess-developer-packages'
>     >>> 
>     >>> since that variable contains package names, rather than
>     >>> function names, I'm confused as to how this is working.
>     >>> 
>     >>> thanks, Stephen
>     >>> 
>     >>> ______________________________________________
>     >>> ESS-help at r-project.org mailing list
>     >>> https://stat.ethz.ch/mailman/listinfo/ess-help
>     >>> 
>     >>> 
>     >>



More information about the ESS-help mailing list