In a case like this, we warn about missing b and C++ compilation fails. It's not clear to me why we don't error trap this in our compilation process. I guess the idea is that we want to allow uncompiled execution with b being found by scoping? I'm not sure that feels compelling to me if that is the reason given we generally want uncompiled and compiled execution to match.
Note that if this were c <- foo(a) with missing foo we do warn about that via a separate mechanism.
As a side note,
test1 <- nimbleFunction(
run = function() {
a <- 7
c <- a+b # warning about 'b' not yet created
return(c)
returnType(double(0))
})
compileNimble(test1)
Compiling
[Note] This may take a minute.
[Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
Error: Failed to create the shared library. Run 'printErrors()' to see the compilation errors.
In addition: Warning message:
variable 'b' has not been created yet.
In a case like this, we warn about missing
b
and C++ compilation fails. It's not clear to me why we don't error trap this in our compilation process. I guess the idea is that we want to allow uncompiled execution withb
being found by scoping? I'm not sure that feels compelling to me if that is the reason given we generally want uncompiled and compiled execution to match.Note that if this were
c <- foo(a)
with missingfoo
we do warn about that via a separate mechanism.As a side note,