Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Macros do not change the language that is executing (as in self-modifying code).

Self-modifying code is possible to express by other means in traditional Lisps that have a quote operator.

In Common Lisp, it is undefined behavior to modify a quoted part of the program.

E.g. this wold be undefined:

  (defun counter () (inc (car '(1))))
The function is referring to a piece of its own syntax (1) which initially holds the integer 1 and incrementing that. This may have the expected effect under some circumstances. Or it could have the expected effect, plus some unexpected effect, or not have the expected effect at all. It may signal an error, also.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: