:|| is a valid symbol in CL, its name is an empty string, "", and it would be much more pleasant to use it for concatenation instead of :||.
The attached patch adds :|| operator.
Stas Boukarev stassats@gmail.com writes:
:|| is a valid symbol in CL, its name is an empty string, "", and it would be much more pleasant to use it for concatenation instead of :||.
The attached patch adds :|| operator.
The manual should be updated as well, stating that :|| can be used without escaping (and that all other |-containing operators should be escaped), but I'll leave that to someone more well-versed in the English language.
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.
Best, Marijn
Marijn Haverbeke marijnh@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.
I added :array-concat in my private fork to avoid typing :||. Being able to use :|| would be a pleasant improvement.
Okay, fine by me. I've fixed your patch to properly handle compile-time expansion, and added a note to the docs.
postmodern-devel@common-lisp.net