unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How the backquote and the comma really work?
@ 2015-06-25 17:09 Marcin Borkowski
  2015-06-25 17:33 ` Michael Heerdegen
                   ` (4 more replies)
  0 siblings, 5 replies; 44+ messages in thread
From: Marcin Borkowski @ 2015-06-25 17:09 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

I decided that the time has come that I finally approach the scary
backquote-comma duo.  (While I understand it superficially, I’d like to
get it right and thoroughly this time.)  So my question is whether my
mental model (see below) is correct.

So, I assume that when Emacs Lisp interpreter encounters a backquote, it
looks at the expression after it.  If it is anything but a list, it just
works like the usual quote, and the backquoted expression evaluates to
what was backquoted.

If it is a list, its element are read and scanned.  If any part of the
list (probably a nested one) begins with a comma, the whole thing after
the comma (be it a symbol, a list or whatever) is evaluated as usual,
and the result is put into the resulting list.

Whew.  Is that (more or less) right?  (I am aware that I didn’t take
into account the splicing operator, but it doesn’t introduce a lot of
additional complexity) Of course, when writing it, I realized that my
natural-language description is not extremely precise, so a bonus
question is: can I find an Emacs Lisp metacircular evaluator (taking
into account the quoting mechanisms) anywhere?

And I know that I risk starting another thread lasting for dozens of
messages;-) – but I /do/ want to understand this stuff...  In fact, in
the spirit of another recent discussion, I want to write a simple code
analyzer, finding one-legged ‘if’s and suggesting replacing them with
‘when’s or ‘unless’es.  This is trivial unless (pun intended) you want
to take (back)quotes into consideration.

Best regards,

-- 
Marcin Borkowski               This email was proudly sent
http://mbork.pl                from my Emacs.



^ permalink raw reply	[flat|nested] 44+ messages in thread
[parent not found: <mailman.5657.1435252169.904.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2015-08-23 16:46 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25 17:09 How the backquote and the comma really work? Marcin Borkowski
2015-06-25 17:33 ` Michael Heerdegen
2015-06-25 18:06   ` Marcin Borkowski
2015-06-25 18:22     ` Michael Heerdegen
2015-06-25 18:39       ` Marcin Borkowski
2015-06-25 18:44         ` Marcin Borkowski
2015-06-25 19:06           ` Michael Heerdegen
2015-07-10 11:36         ` Marcin Borkowski
2015-07-12 15:54           ` Michael Heerdegen
2015-07-12 19:55             ` Marcin Borkowski
2015-07-12 20:33               ` Marcin Borkowski
2015-07-14 18:17                 ` Marcin Borkowski
2015-07-14 22:08                   ` Emanuel Berg
2015-07-21 22:08                   ` Michael Heerdegen
2015-07-24 13:01                     ` Michael Heerdegen
2015-08-11 11:41                       ` Marcin Borkowski
2015-08-12 15:29                         ` Michael Heerdegen
     [not found]                         ` <mailman.8207.1439393377.904.help-gnu-emacs@gnu.org>
2015-08-12 16:30                           ` Pascal J. Bourguignon
2015-08-23  8:30                             ` Marcin Borkowski
     [not found]                             ` <mailman.110.1440318650.11330.help-gnu-emacs@gnu.org>
2015-08-23 16:46                               ` Pascal J. Bourguignon
2015-07-21 21:54                 ` Michael Heerdegen
2015-08-11 10:15                   ` Marcin Borkowski
2015-08-11 17:20                     ` Thorsten Jolitz
2015-08-12 15:01                       ` Michael Heerdegen
2015-07-21 21:50               ` Michael Heerdegen
2015-06-25 18:10 ` Drew Adams
2015-06-25 18:40   ` Michael Heerdegen
2015-06-25 18:53     ` Marcin Borkowski
2015-06-25 19:39       ` Michael Heerdegen
2015-06-25 20:05         ` Drew Adams
2015-06-25 20:18           ` Marcin Borkowski
2015-06-25 20:37             ` Drew Adams
2015-06-25 23:55     ` Robert Thorpe
     [not found]     ` <mailman.5697.1435276533.904.help-gnu-emacs@gnu.org>
2015-06-26  1:41       ` Rusi
2015-06-26 14:24         ` Michael Heerdegen
     [not found]         ` <mailman.5716.1435328741.904.help-gnu-emacs@gnu.org>
2015-06-26 14:35           ` Rusi
2015-06-26 14:51             ` Michael Heerdegen
2015-06-25 18:46   ` Marcin Borkowski
2015-06-26  7:31 ` tomas
2015-06-26 13:48   ` Drew Adams
2015-06-26 14:06     ` tomas
2015-06-26 15:06 ` Emanuel Berg
2015-07-12 17:38 ` Vaidheeswaran C
     [not found] <mailman.5657.1435252169.904.help-gnu-emacs@gnu.org>
2015-06-30 16:27 ` sokobania.01

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).