卫生宏

卫生宏英語:),又称干净宏,是指其扩展保证不会导致意外捕获标识符的Scheme[1]Dylan[2]Rust[3]NimJulia编程语言都有这一特性。在引入卫生宏之前,Lisp社区有众所周知的意外捕获的问题。宏编写者会使用产生唯一标识符的语言特性(如gensym)或使用混淆的标识符来避免这一问题。卫生宏是对捕获问题的一种程序化解决方案,集成在宏扩展器本身中。「卫生」这一术语是在Kohlbecker等人1986年的论文中创造的,灵感来自数学中使用的术语。[4]

参考文献

  1. . schemers.org. [2022-08-19]. (原始内容存档于2022-08-11).
  2. Barrett, Kim; Cassels, Bob; Haahr, Paul; Moon, David A.; Playford, Keith; Withington, P. Tucker. . Proceedings of the 11th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications - OOPSLA '96 (New York, New York, USA: ACM Press). 1996. doi:10.1145/236337.236343.
  3. . www.chiark.greenend.org.uk. [2022-08-19]. (原始内容存档于2021-10-06) (英语).
  4. Kohlbecker, E.; Friedman, D. P.; Felleisen, M.; Duba, B. (PDF). . 1986 [2022-08-19]. (原始内容存档 (PDF)于2017-08-29).
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.