Re: [Rd] speedbump in library

2015-01-26 Thread Martin Maechler
> Michael Lawrence > on Mon, 26 Jan 2015 06:11:50 -0800 writes: > isLoadedNamespace() sounds fine to me.. > Thanks for addressing this, > Michael Ok, this is now in R-devel : r67624 | maechler | 201

Re: [Rd] speedbump in library

2015-01-26 Thread Michael Lawrence
isLoadedNamespace() sounds fine to me.. Thanks for addressing this, Michael On Mon, Jan 26, 2015 at 5:51 AM, Martin Maechler < maech...@lynne.stat.math.ethz.ch> wrote: > > Michael Lawrence > > on Mon, 26 Jan 2015 05:12:55 -0800 writes: > > > A isNamespaceLoaded() function would

Re: [Rd] speedbump in library

2015-01-26 Thread Martin Maechler
> Michael Lawrence > on Mon, 26 Jan 2015 05:12:55 -0800 writes: > A isNamespaceLoaded() function would be a useful thing to > have in general if we are interested in readable code. An > efficient implementation would be just a bonus. Good point (readability), and thank yo

Re: [Rd] speedbump in library

2015-01-26 Thread Michael Lawrence
A isNamespaceLoaded() function would be a useful thing to have in general if we are interested in readable code. An efficient implementation would be just a bonus. On Mon, Jan 26, 2015 at 3:36 AM, Martin Maechler wrote: >> Winston Chang >> on Fri, 23 Jan 2015 10:15:53 -0600 writes:

Re: [Rd] speedbump in library

2015-01-26 Thread Martin Maechler
> Winston Chang > on Fri, 23 Jan 2015 10:15:53 -0600 writes: > I think you can simplify a little by replacing this: > pkg %in% loadedNamespaces() > with this: > .getNamespace(pkg) almost: It would be !is.null(.getNamespace(pkg)) > Whereas getNamespa

Re: [Rd] speedbump in library

2015-01-23 Thread Peter Haverty
Thanks Winston, Yes, your version of that part is more direct. I guess it would need a ! is.null() too. I think we should use .getNamespace. It It also occurred to me that this %in% check (which happens in a few places) is kind of roundabout. It equates to "foo" %in% ls(.Internal(getNamespaceReg

Re: [Rd] speedbump in library

2015-01-23 Thread Winston Chang
I think you can simplify a little by replacing this: pkg %in% loadedNamespaces() with this: .getNamespace(pkg) Whereas getNamespace(pkg) will load the package if it's not already loaded, calling .getNamespace(pkg) (note the leading dot) won't load the package. I can't speak to whether there a