[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Built-in macros that execute arbitrary code
From: |
Eshel Yaron |
Subject: |
Built-in macros that execute arbitrary code |
Date: |
Wed, 22 Jan 2025 09:44:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi all,
Yesterday I found out about another built-in macro that can execute
arbitrary code during macro-expansion: cl-macrolet. Here's a simple
example of (ab)using this macro to create a file during macro-expansion:
(cl-macrolet ((foo () (call-process "touch" nil nil nil "/tmp/owned")))
(foo))
This expands to just 0 after "touch"ing the file /tmp/owned. Note that
this happens during macro-expansion, not in runtime.
So the built-in macros I currently know of that run arbitrary code are:
static-if, cl-eval-when, eval-when-compile, eval-and-compile,
let-when-compile, rx, cl-macrolet.
Any others that I missed?
Regards,
Eshel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Built-in macros that execute arbitrary code,
Eshel Yaron <=