Skip to content
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

[bug?] format.options_env() tries to evaluate options even if unset #14

Closed
tdeenes opened this issue Apr 23, 2024 · 1 comment · Fixed by #16
Closed

[bug?] format.options_env() tries to evaluate options even if unset #14

tdeenes opened this issue Apr 23, 2024 · 1 comment · Fixed by #16
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@tdeenes
Copy link
Contributor

tdeenes commented Apr 23, 2024

optenv <- define_option("test")
print(optenv)
# Error: argument is missing, with no default

I think the problem is with line values <- as.list(x) in format.options_env(). The call as.list() forces the evaluation of promises, which fails if the promise is an empty symbol (bquote()) or references any non-existing symbol in the environment. Instead of as.list(), the function should loop through the individual elements and render the unevaluated expression (see ?delayedAssign for the eval(substitute(substitute(...))) idiom, or simply take the specs defaults) and its evaluated value only if available. Otherwise, render <unset> or the error message, but do not fail.

@dgkf
Copy link
Owner

dgkf commented Apr 24, 2024

Certainly a bug. At the very minimum, the error message is unhelpful, but I think overall the behavior can certainly be improved. Thanks for reporting this.

@dgkf dgkf added bug Something isn't working enhancement New feature or request labels Apr 24, 2024
@dgkf dgkf added this to the 0.2.0 milestone Apr 24, 2024
@dgkf dgkf closed this as completed in #16 May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants