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

call_modify fails on arg = NULL when arg is not in the call #393

Closed
vspinu opened this issue Jan 27, 2018 · 3 comments
Closed

call_modify fails on arg = NULL when arg is not in the call #393

vspinu opened this issue Jan 27, 2018 · 3 comments
Labels

Comments

@vspinu
Copy link

@vspinu vspinu commented Jan 27, 2018

On deletion, the lookup of non-existing args is not consistent with list[["arg"]] <- NULL or list$arg <- NULL:

> call_modify(quote(foo(a = 1)), ... = NULL)
Error in expr[[nm]] <- args[[nm]] : subscript out of bounds

This makes using deletion programatically inconvenient, as an extra check for arg presence is required.

@vspinu
Copy link
Author

@vspinu vspinu commented Jan 27, 2018

Conversely, how would you add ... to a call consistently?

> call_modify(quote(foo(a = 1)), quote(...)) # OK
foo(a = 1, ...)
> call_modify(quote(foo(a = 1, ...)), quote(...)) # Not OK
foo(a = 1, ..., ...)

(I need this for arg-lists not calls as such.)

Thanks.

@lionel- lionel- added the expr:call label Jan 27, 2018
@lionel- lionel- closed this in cdb713c Oct 1, 2018
@lionel-
Copy link
Member

@lionel- lionel- commented Oct 1, 2018

Conversely, how would you add ... to a call consistently?

I'm not sure, but I think it wouldn't feel right to special-case ... here.

@lionel-
Copy link
Member

@lionel- lionel- commented Oct 1, 2018

Hmm... Thinking more about it, it does make sense to special case it. In a way it is similar to a named argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants