Extend assignment_operator to optionally allow '=' assignments #2698
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2441. Tests are partially copied from #2521 -- for implementation I'm starting from scratch rather than trying to re-work it based on the discussion there. Thanks @J-Moravec for getting things started & the fruitful discussion!
Pausing here for, well, even more discussion :)
I'm getting hung up on the interaction of the proposed argument with the other arguments, particularly
allow_right_assign
andallow_pipe_assign
.If we have
(allow_right_assign=FALSE, top_level_operator="any")
, that does makex -> 2
a bit ambiguous, right?I can think of two options:
top_level_operator = c("<-", "->", "%<>%")
to be equivalent to the current(allow_right_assign=TRUE, allow_pipe_assign=TRUE)
. That looks pretty transparent to me, but presents some back-compatibility issues.any
in favor ofeither
, i.e. either<-
or=
.WDYT @IndrajeetPatil @AshesITR?