-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected error when trying to access non-existent variable from module #360
Comments
Thanks for the catch! I don’t know much about Do you know about the performance implications of switching to I’d be happy about a PR! |
so for
It means you can entirely skip the process of finding I use it in I would've originally told you that the performance between |
Sorry to so suddenly change my mind, but I just remembered why I switched from using At one point, I was doing something similar to obtain So now that we know the current method of determining
and between the two of those, |
Error description
I tried to access a variable from a module but had mistyped the name, so it tried to throw an error with message
"name '%s' not found in '%s'"
. Instead of doing that, it threw a different error with message"'Rf_translateChar' must be called on a CHARSXP, but got 'symbol'"
because the C function assumes the first argument is a symbol. As an example:I'm not sure what the exact expected output would be, but any of the following error messages would suffice:
stop(sprintf("name '%s' not found in '%s'", "test", "x$utils"))
stop(sprintf("name '%s' not found in '%s'", "test", attr(x$utils, "name")))
stop(sprintf("name '%s' not found in '%s'", "test", attr(x$utils, "spec")$alias))
That being said, I think your C code to generate such an error is unnecessarily complex, and could be greatly simplified with the use of
.External2
instead of.Call
. I could submit a PR if you like!R version
‘box’ version
[1] ‘1.2.0’
The text was updated successfully, but these errors were encountered: