Skip to content
Prev 49742 / 63424 Next

speedbump in library

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(getNamespaceRegistry()), all.names = TRUE)

We lack and R-level accessor for the namespace registry, but if we had
one we could do

getNamespaceRegistry()[["foo"]]

, which is just a hash lookup.



I'm getting a bit off topic here, but ...

"foo" %in% vector is a common pattern and reads well, but

any(vector == "foo")

is less work and much faster.  I wonder if there is room for a fast
path there ...



Pete

____________________
Peter M. Haverty, Ph.D.
Genentech, Inc.
phaverty at gene.com
On Fri, Jan 23, 2015 at 8:15 AM, Winston Chang <winstonchang1 at gmail.com> wrote: