rlang icon indicating copy to clipboard operation
rlang copied to clipboard

Concatenation of a quosure and a list of quosure is not interchangeable

Open DanChaltiel opened this issue 1 year ago • 1 comments

Hi,

This is probably a quibbling corner case of minor importance but it seems that the concatenation of quo() and quos() depends on the order of the operation:

cols = rlang::quo(c(mpg, gear))
dots = rlang::quos(cyl, am)

class(cols)
#> [1] "quosure" "formula"
class(dots)
#> [1] "quosures" "list"
class(c(dots, cols))
#> [1] "quosures" "list"
class(c(cols, dots))
#> [1] "list"

Created on 2022-07-22 by the reprex package (v2.0.1)

In the latter case, the quosures class is lost but I'm not sure that this class is important or if this can cause any trouble at all.

This is obviously caused by the absence of rlang:::c.quosure() but the result is a bit unexpected. Maybe c.quosures() could be aliased to c.quosure()?

DanChaltiel avatar Jul 22 '22 07:07 DanChaltiel

I'm pretty sure this should be an error in all cases so can you please use c(list(quo), quos) instead?

lionel- avatar Jul 22 '22 08:07 lionel-