Ok, here is my attempt at a function to get the list of user-defined
free variables that a function refers to:
https://gist.github.com/DarwinAwardWinner/7298557
Is uses codetools, so it is subject to the limitations of that package,
but for simple examples, it successfully detects when a funct
Ryan (et al),
FYI:
> f
function() {
x = rnorm(x)
x
}
> findGlobals(f)
[1] "=" "{" "rnorm"
"x" should be in the list of globals but it isn't.
~G
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3]
Looking at the codetools package, I think "findGlobals" is basically
exactly what we want here, right? As you say, there are necessarily
limitations due to R being a dynamic language, but the goal is to catch
common errors, not stop people from tricking the check.
I think I'll try to code somet
I guess all we need to do is to detect whether a function would try to
access a free variable in the user's workspace, and warn/error if so.
It looks like CodeDepends could do that. I could try to come up with an
implementation. I guess we would add CodeDepends as an optional
dependency for Bio
Henrik,
See https://github.com/duncantl/CodeDepends (as used by used by
https://github.com/gmbecker/RCacheSuite). It will identify necessarily
defined symbols (input variables) for code that is not doing certain tricks
(eg get(), mixing data.frame columns and gobal variables in formulas, etc ).
T
Another potential easy step we can do is that if FUN function in the
user's workspace, we automatically export that function under the same
name in the children. This would make recursive functions just work, but
it might be a bit too magical.
On 11/3/13, 2:38 PM, Ryan wrote:
Here's an easy th
Here's an easy thing we can add to BiocParallel in the short term. The
following code defines a wrapper function "withBPExtraErrorText" that
simply appends an additional message to the end of any error that looks
like it is about a missing variable. We could wrap every evaluation in
a similar t
On Sun, Nov 3, 2013 at 1:29 PM, Michael Lawrence
wrote:
> An analog to clusterExport is a good idea. To make it even easier, we could
> have a dynamic environment based on object tables that would catch missing
> symbols and download them from the parent thread. But maybe there's some
> benefit to
An analog to clusterExport is a good idea. To make it even easier, we could
have a dynamic environment based on object tables that would catch missing
symbols and download them from the parent thread. But maybe there's some
benefit to being explicit?
Michael
On Sun, Nov 3, 2013 at 12:39 PM, Henr
Hi,
in BiocParallel, is there a suggested (or planned) best standards for
making *locally* assigned variables (e.g. functions) available to the
applied function when it runs in a separate R process (which will be
the most common use case)? I understand that avoid local variables
should be avoided
10 matches
Mail list logo