[postmodern-devel] Patch: Make :|| (symbol with an empty name) equivalent to :\|\|
Stas Boukarev
stassats at gmail.com
Mon Nov 21 08:08:45 UTC 2011
Marijn Haverbeke <marijnh at gmail.com> writes:
> Hi Stas,
>
> This seems a bit overly obscure. It should be easy to add this in a
> project (outside of S-SQL) if you find that typing \|\| is slowing you
> down, but I'd rather not put it in the library itself.
What do you mean by "obscure"? It doesn't use any hidden features of
Common Lisp and it's supported by all implementations.
I can't imagine it being harder to understand than having to use escape
characters.
In fact, if one is unfamiliar with the special characteristics of #\|
in CL (which isn't used very often), and will try to use :|| (as it's
presented in the documentation), it won't produce a syntax error neither
by the CL reader, nor by s-sql, and not even by PostgreSQL.
(query (:select (:|| "a" "b"))) results in (("(a,b)")) which would be
quite hard to diagnose.
I also propose to amend the documentation to explicitly state that :||
will work, why it works, and that other operators with | have to be
escaped.
I'd rather use "concatenate" or at least "concat" as a name for the
concatenation operator, but seeing as s-sql aims to mimic the syntax
of PostgreSQL's flavor of SQL, I think it's desirable to do so as close
as reasonably possible, especially if it improves readability and
writeability and comes at no additional cost.
I'd like to hear opinions of other users of postmodern on the matter.
--
With best regards, Stas.
More information about the postmodern-devel
mailing list