Closed LiberalArtist closed 5 years ago
Thanks! This looks good. Can you change the version to "1.2" instead of "1.1.1"? I don't think there's a need for three-level version numbers.
Regarding the AST is-a issue, I'm worried about creating an overlap between ScalarExpr and TableExpr/Ref, so I think it would be better to describe the workaround for now. There are some other cases that might need straightening out, though; for example using a Select as a TableExpr.
Ok, I've changed to "1.2". I also added history
annotations for everything changed since "1.1".
I see what you mean about the AST issues. I think it makes sense to defer addressing that for now.
Merged, thanks!
This commit extends the grammar for
ident
andname
to include(Ident:AST (unquote ast-racket-expr))
and(Name:AST (unquote ast-racket-expr))
, respectively, where the inserted AST value must satisfy the corresponding (pre-existing) predicate, i.e.ident-ast?
orname-ast?
.The motivation is to make it possible to abstract over the table name in
INSERT
,UPDATE
,DELETE
, andCREATE TABLE
statements, though the additions should be more generally useful. For example, the following function now works as expected:Writing such a function was not possible before, as the term following
#:from
is restricted to be atable-name
, not an arbitarytable-ref
.There is an oddity in the interaction between the
name
nonterminal and thetable-ref
nonterminal due to the internal representation. Given anident
AST value:the
id
value will not satisfytable-ref-ast?
, and attempting to use it as atable-ref
(e.g.(select col #:from (TableRef:AST ,id))
) will raise an exception.A workaround is needed to make the library wrap the value in a
table-ref:name
struct:It would seem desirable to investigate adjusting the internal representations to make values that satisfy
name-ast?
also satisfytable-ref-ast?
. Alternatively, the workaround could be documented.Incremented package version to "1.1.1".