What You've Learned

This chapter covered macro programming. You’ve learned the following:

  • Macros let you write code that writes code. With macros, you can create your own programming language and convert it to standard Lisp just before the compiler can get a peek at it.

  • Macros allow you to get rid of that feeling of déjà vu when writing your code, in situations when nothing else can do so.

  • You must be careful when writing macros so that they don’t lead to unintentional, repeated execution of code.

  • You need to be careful to avoid unintended variable capture in macros. You can avoid this by using gensym names.

  • If variables created by a macro are exposed on purpose, as a feature of the macro, the macro is called an anaphoric macro.

  • Macro programming is a very powerful technique. However, try to use functional programming instead to solve a problem whenever possible. Macros should always be a last resort.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.185.87