Open paciorek opened 1 year ago
So the issue here seems to be that in exprClasses_setSizes
we invoke if (exists(code$name)) {
. If nimNothing
is exported it is found in the package namespace based on the nested enclosing environments. If it is not exported it is not found.
Not seeing how to deal with this at the moment...
So if we have a private nimbleFunction in nimble
then it can be found when inside the compilation process because we are in the package namespace and private members are available. If it is in another package, I don't see a way to get around exporting all the nfs.
As far as the inscrutable error, that seems to be a separate issue not related to scoping. I will file a separate issue about that. Once that is error trapped at least it will be more obvious that nimNothing
is not being found.
Just a note that as of 1.1.0 we will now report that nimNothing
is not being found, so at least the source of the issue should be clearer.
Consider a package with these nimbleFunctions:
A user reported that if
nimNothing
is not exported, one gets this error when compilingnestedNim
:The issue arises in the call to
sizeReturn
, in particular the recursive callasserts <- recurseSetSizes(code, symTab, typeEnv)
.If
nimNothing
is exported, we see:if not exported, we see:
So apparently because of the exporting, some additional processing of the
nimNothing
RCfun has happened. I haven't dug deeper but I will do so when I have time.It's a bit surprising this hasn't come up before.