I mean to be using it as the root of the AST for an expression, though that isn’t clear in my post.
But a quosure is an expression because you can evaluate it just as you can a bare expression, albeit with a different mechanism. Or maybe it’s better to say that it’s an expression in the language model of R that the rlang package uses.
rlang::is_expr returns TRUE when applied to a quosure and also when applied to the object returned by get_expr. So the rlang package sees quosures as expressions. But rlang is working on a language model of, not the syntax of R. Each has a different idea of what an expression is.
So to me quosure means get me the AST for an expression along with the context of the expression.
The thing I find interesting is that the quosure seems to be a proxy for a lisp list. It, in effect, translates an expression like
a * b + c * d, which is a syntax you can use in R but doesn’t exist in lisp (or HP RPN calculators for that matter), into a syntax lisp can use, which would be
(+(* a b)(* c d))
That’s what the tree I generated and then drew with DiagrammeR is showing.
The first item in a lisp list is returned by rlang::head, and the rest of the list is returned by rlang::tail. These correspond to car and cdr in lisp (I think, sort of) which is a terminology for parts of the architecture of the machines early versions of lisp ran on. Even though I have designed computers I’ve never, and still don’t, understand how car and cdr help explain how lisp works. But as soon as I saw the lang_head and lang_tail functions it all made sense to me.
So mostly what I’ve been looking at lately is the language model of R which is surfaced by the rlang package.