emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NonGNU ELPA] New package: sqlite3


From: Philip Kaludercic
Subject: Re: [NonGNU ELPA] New package: sqlite3
Date: Wed, 22 Mar 2023 08:00:23 +0000

Tomas Hlavaty <tom@logand.com> writes:

> On Tue 21 Mar 2023 at 21:12, Philip Kaludercic <philipk@posteo.net> wrote:
>>>> To me the
>>>> advantage of something like `rx' is that I can insert comments and make
>>>> use of regular indentation.
>>>
>>> Those are cosmetic advantages.
>>> There are more profound advatages.
>>
>> In what way profound?
>
> For example, the Lisp environment provides many tools that understand
> and help with lisp code (jumping, help, autodoc, compilation, warnings,
> errors debugging etc).  With strings, one cannot take advantage of any
> those.  Another: making sure that things have the right structure, make
> sense to some extent and output is properly escaped.  It is also much
> easier to process or transform such cons tree than process or transform
> a string with some kind of syntax.

It might be easier, but it certainly possible to have the tools that
take advantage of lisp code also understand specific strings.  This is
not what I would call "profound".

>> Tomas Hlavaty <tom@logand.com> writes:
>>> On Tue 21 Mar 2023 at 16:53, Philip Kaludercic <philipk@posteo.net> wrote:
>>>> I really, really have no idea what you are getting at.  As in "ok, but
>>>> what is your intent in explaining this?".
>>>>
>>>> Are you trying to propose that Emacs circumvents the SQLite API (that as
>>>> far as I see uses strings) by constructing statement objects manually?
>>>
>>> The idea is that one should not concatenate strings by hand but one
>>> should write the query as sexp (likely build that cons tree using quote
>>> or backquote).  That cons tree should then be converted to string by a
>>> lisp function.  Only after that should the string be passed to sqlite.
>>>
>>>    sexp (cons tree) -> string -> sqlite
>>
>> I was under the impression that Lynn was advocating for avoiding the
>> usage any strings.  In general this is nice and I'd use it if built-in,
>> but seeing as SQL is more readable than regular expressions I am not
>> under the impression that there is the same need for it.
>
> The point is that it is better to use an sexp based syntax than string
> based syntax in both cases, for sql and for regular expressions.  This
> is a general idea, one can apply it to html, css, xml, pdf, docx, xlsx,
> ooxml etc.  anywhere where one needs to output some kind of arbitrary
> (non-sexp based) syntax.
>
> The fact that in the end a string is passed to sqlite is not
> interesting.  Interesting is that one writes sql not by concatenating
> strings but by building cons trees, similar to what one does when
> writing lisp code.

I agree that we should strings ought not to be concatenated.  My issue
is that I am under the impression that constructing SQL statements from
s-expressions is more complicated than it is to construct regular
expressions, and I don't know if it is worth the effort or if
parameterised queries suffice?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]