CINXE.COM
Hygienic macro - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Hygienic macro - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"d028d6f2-6bf8-4ef7-81da-bef01ca86000","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Hygienic_macro","wgTitle":"Hygienic macro","wgCurRevisionId":1255215995,"wgRevisionId":1255215995,"wgArticleId":373314,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles with short description","Short description is different from Wikidata","Wikipedia articles that are too technical from November 2016","All articles that are too technical","Articles lacking in-text citations from April 2012","All articles lacking in-text citations","Transformation languages","Scheme (programming language)","Dylan (programming language)","Metaprogramming"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext", "wgRelevantPageName":"Hygienic_macro","wgRelevantArticleId":373314,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":20000,"wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q17157225","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness", "fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher", "ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Hygienic macro - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Hygienic_macro"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Hygienic_macro&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Hygienic_macro"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Hygienic_macro rootpage-Hygienic_macro skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Hygienic+macro" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Hygienic+macro" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Hygienic+macro" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Hygienic+macro" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-The_hygiene_problem" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#The_hygiene_problem"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>The hygiene problem</span> </div> </a> <button aria-controls="toc-The_hygiene_problem-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle The hygiene problem subsection</span> </button> <ul id="toc-The_hygiene_problem-sublist" class="vector-toc-list"> <li id="toc-Variable_shadowing" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Variable_shadowing"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Variable shadowing</span> </div> </a> <ul id="toc-Variable_shadowing-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Standard_library_function_redefinition" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Standard_library_function_redefinition"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Standard library function redefinition</span> </div> </a> <ul id="toc-Standard_library_function_redefinition-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Program-defined_function_redefinition" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Program-defined_function_redefinition"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.3</span> <span>Program-defined function redefinition</span> </div> </a> <ul id="toc-Program-defined_function_redefinition-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Strategies_used_in_languages_that_lack_hygienic_macros" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Strategies_used_in_languages_that_lack_hygienic_macros"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Strategies used in languages that lack hygienic macros</span> </div> </a> <button aria-controls="toc-Strategies_used_in_languages_that_lack_hygienic_macros-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Strategies used in languages that lack hygienic macros subsection</span> </button> <ul id="toc-Strategies_used_in_languages_that_lack_hygienic_macros-sublist" class="vector-toc-list"> <li id="toc-Obfuscation" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Obfuscation"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Obfuscation</span> </div> </a> <ul id="toc-Obfuscation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Temporary_symbol_creation" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Temporary_symbol_creation"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2</span> <span>Temporary symbol creation</span> </div> </a> <ul id="toc-Temporary_symbol_creation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Read-time_uninterned_symbol" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Read-time_uninterned_symbol"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.3</span> <span>Read-time uninterned symbol</span> </div> </a> <ul id="toc-Read-time_uninterned_symbol-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Packages" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Packages"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.4</span> <span>Packages</span> </div> </a> <ul id="toc-Packages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Literal_objects" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Literal_objects"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.5</span> <span>Literal objects</span> </div> </a> <ul id="toc-Literal_objects-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Hygienic_transformation" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Hygienic_transformation"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Hygienic transformation</span> </div> </a> <ul id="toc-Hygienic_transformation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Implementations" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Implementations"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Implementations</span> </div> </a> <button aria-controls="toc-Implementations-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Implementations subsection</span> </button> <ul id="toc-Implementations-sublist" class="vector-toc-list"> <li id="toc-Syntax-rules" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Syntax-rules"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1</span> <span>Syntax-rules</span> </div> </a> <ul id="toc-Syntax-rules-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Syntax-case" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Syntax-case"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2</span> <span>Syntax-case</span> </div> </a> <ul id="toc-Syntax-case-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Other_systems" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Other_systems"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.3</span> <span>Other systems</span> </div> </a> <ul id="toc-Other_systems-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Languages_with_hygienic_macro_systems" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Languages_with_hygienic_macro_systems"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.4</span> <span>Languages with hygienic macro systems</span> </div> </a> <ul id="toc-Languages_with_hygienic_macro_systems-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Criticism" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Criticism"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Criticism</span> </div> </a> <ul id="toc-Criticism-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Hygienic macro</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 3 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-3" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">3 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%9C%84%EC%83%9D_%EB%A7%A4%ED%81%AC%EB%A1%9C" title="위생 매크로 – Korean" lang="ko" hreflang="ko" data-title="위생 매크로" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E5%81%A5%E5%85%A8%E3%81%AA%E3%83%9E%E3%82%AF%E3%83%AD" title="健全なマクロ – Japanese" lang="ja" hreflang="ja" data-title="健全なマクロ" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E5%8D%AB%E7%94%9F%E5%AE%8F" title="卫生宏 – Chinese" lang="zh" hreflang="zh" data-title="卫生宏" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q17157225#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Hygienic_macro" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Hygienic_macro" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Hygienic_macro"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Hygienic_macro&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Hygienic_macro&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Hygienic_macro"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Hygienic_macro&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Hygienic_macro&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Hygienic_macro" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Hygienic_macro" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Hygienic_macro&oldid=1255215995" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Hygienic_macro&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Hygienic_macro&id=1255215995&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHygienic_macro"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHygienic_macro"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Hygienic_macro&action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Hygienic_macro&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q17157225" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Macros whose expansion is guaranteed not to cause the capture of identifiers</div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><table class="box-Technical plainlinks metadata ambox ambox-style ambox-technical" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/40px-Edit-clear.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/60px-Edit-clear.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/80px-Edit-clear.svg.png 2x" data-file-width="48" data-file-height="48" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article <b>may be too technical for most readers to understand</b>.<span class="hide-when-compact"> Please <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Hygienic_macro&action=edit">help improve it</a> to <a href="/wiki/Wikipedia:Make_technical_articles_understandable" title="Wikipedia:Make technical articles understandable">make it understandable to non-experts</a>, without removing the technical details.</span> <span class="date-container"><i>(<span class="date">November 2016</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <p>In <a href="/wiki/Computer_science" title="Computer science">computer science</a>, <b>hygienic macros</b> are <a href="/wiki/Macro_(computer_science)" title="Macro (computer science)">macros</a> whose expansion is guaranteed not to cause the accidental <a href="#The_hygiene_problem">capture</a> of <a href="/wiki/Identifier" title="Identifier">identifiers</a>. They are a feature of <a href="/wiki/Programming_language" title="Programming language">programming languages</a> such as <a href="/wiki/Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a>,<sup id="cite_ref-r5rs_1-0" class="reference"><a href="#cite_note-r5rs-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> <a href="/wiki/Dylan_(programming_language)" title="Dylan (programming language)">Dylan</a>,<sup id="cite_ref-dylan_2-0" class="reference"><a href="#cite_note-dylan-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> <a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a>, <a href="/wiki/Nim_(programming_language)" title="Nim (programming language)">Nim</a>, and <a href="/wiki/Julia_(programming_language)" title="Julia (programming language)">Julia</a>. The general problem of accidental capture was well known in the <a href="/wiki/Lisp_(programming_language)" title="Lisp (programming language)">Lisp</a> community before the introduction of hygienic macros. Macro writers would use language features that would generate unique identifiers (e.g., gensym) or use obfuscated identifiers to avoid the problem. Hygienic macros are a programmatic solution to the capture problem that is integrated into the macro expander. The term "hygiene" was coined in Kohlbecker et al.'s 1986 paper that introduced hygienic macro expansion, inspired by terminology used in mathematics.<sup id="cite_ref-hygiene_3-0" class="reference"><a href="#cite_note-hygiene-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="The_hygiene_problem">The hygiene problem</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=1" title="Edit section: The hygiene problem"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Variable_shadowing">Variable shadowing</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=2" title="Edit section: Variable shadowing"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In programming languages that have non-hygienic macro systems, it is possible for existing variable bindings to be hidden from a macro by variable bindings that are created during its expansion. In <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, this problem can be illustrated by the following fragment: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cp">#define INCI(i) { int a=0; ++i; }</span> <span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">8</span><span class="p">;</span> <span class="w"> </span><span class="n">INCI</span><span class="p">(</span><span class="n">a</span><span class="p">);</span> <span class="w"> </span><span class="n">INCI</span><span class="p">(</span><span class="n">b</span><span class="p">);</span> <span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"a is now %d, b is now %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div> <p>Running the above through the <a href="/wiki/C_preprocessor" title="C preprocessor">C preprocessor</a> produces: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">8</span><span class="p">;</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="o">++</span><span class="n">a</span><span class="p">;</span><span class="w"> </span><span class="p">};</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="o">++</span><span class="n">b</span><span class="p">;</span><span class="w"> </span><span class="p">};</span> <span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"a is now %d, b is now %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div> <p>The variable <code>a</code> declared in the top scope is <a href="/wiki/Variable_shadowing" title="Variable shadowing">shadowed</a> by the <code>a</code> variable in the macro, which introduces a new <a href="/wiki/Scope_(computer_science)#Lexical_scoping" title="Scope (computer science)">scope</a>. As a result, <code>a</code> is never altered by the execution of the program, as the output of the compiled program shows: </p> <pre>a is now 4, b is now 9 </pre> <div class="mw-heading mw-heading3"><h3 id="Standard_library_function_redefinition">Standard library function redefinition</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=3" title="Edit section: Standard library function redefinition"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The hygiene problem can extend beyond variable bindings. Consider this <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a> macro: </p> <div class="mw-highlight mw-highlight-lang-lisp mw-content-ltr" dir="ltr"><pre><span></span><span class="p">(</span><span class="nb">defmacro</span><span class="w"> </span><span class="nv">my-unless</span><span class="w"> </span><span class="p">(</span><span class="kt">condition</span><span class="w"> </span><span class="k">&body</span><span class="w"> </span><span class="nv">body</span><span class="p">)</span> <span class="w"> </span><span class="o">`</span><span class="p">(</span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">not</span><span class="w"> </span><span class="o">,</span><span class="kt">condition</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">progn</span> <span class="w"> </span><span class="o">,@</span><span class="nv">body</span><span class="p">)))</span> </pre></div> <p>While there are no references to variables in this macro, it assumes the symbols "if", "not", and "progn" are all bound to their usual definitions in the standard library. If, however the above macro is used in the following code: </p> <div class="mw-highlight mw-highlight-lang-lisp mw-content-ltr" dir="ltr"><pre><span></span><span class="p">(</span><span class="k">flet</span><span class="w"> </span><span class="p">((</span><span class="nb">not</span><span class="w"> </span><span class="p">(</span><span class="nv">x</span><span class="p">)</span><span class="w"> </span><span class="nv">x</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="nv">my-unless</span><span class="w"> </span><span class="no">t</span> <span class="w"> </span><span class="p">(</span><span class="nb">format</span><span class="w"> </span><span class="no">t</span><span class="w"> </span><span class="s">"This should not be printed!"</span><span class="p">)))</span> </pre></div> <p>The definition of "not" has been locally altered and so the expansion of <code>my-unless</code> changes. </p><p>Note however that for Common Lisp this behavior is forbidden, as per <a rel="nofollow" class="external text" href="https://www.lispworks.com/documentation/lw70/CLHS/Body/11_abab.htm">11.1.2.1.2 Constraints on the COMMON-LISP Package for Conforming Programs</a>. It is also possible to completely redefine functions anyway. Some implementations of Common Lisp provide <a rel="nofollow" class="external text" href="https://www.sbcl.org/manual/#Package-Locks">Package Locks</a> to prevent the user to change definitions in packages by mistake. </p> <div class="mw-heading mw-heading3"><h3 id="Program-defined_function_redefinition">Program-defined function redefinition</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=4" title="Edit section: Program-defined function redefinition"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Of course, the problem can occur for program-defined functions in a similar way: </p> <div class="mw-highlight mw-highlight-lang-lisp mw-content-ltr" dir="ltr"><pre><span></span><span class="p">(</span><span class="nb">defun</span><span class="w"> </span><span class="nv">user-defined-operator</span><span class="w"> </span><span class="p">(</span><span class="nb">cond</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="nb">not</span><span class="w"> </span><span class="nb">cond</span><span class="p">))</span> <span class="p">(</span><span class="nb">defmacro</span><span class="w"> </span><span class="nv">my-unless</span><span class="w"> </span><span class="p">(</span><span class="kt">condition</span><span class="w"> </span><span class="k">&body</span><span class="w"> </span><span class="nv">body</span><span class="p">)</span> <span class="w"> </span><span class="o">`</span><span class="p">(</span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nv">user-defined-operator</span><span class="w"> </span><span class="o">,</span><span class="kt">condition</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">progn</span> <span class="w"> </span><span class="o">,@</span><span class="nv">body</span><span class="p">)))</span> <span class="c1">; ... later ...</span> <span class="p">(</span><span class="k">flet</span><span class="w"> </span><span class="p">((</span><span class="nv">user-defined-operator</span><span class="w"> </span><span class="p">(</span><span class="nv">x</span><span class="p">)</span><span class="w"> </span><span class="nv">x</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="nv">my-unless</span><span class="w"> </span><span class="no">t</span> <span class="w"> </span><span class="p">(</span><span class="nb">format</span><span class="w"> </span><span class="no">t</span><span class="w"> </span><span class="s">"This should not be printed!"</span><span class="p">)))</span> </pre></div> <p>The use site redefines <code>user-defined-operator</code> and hence changes the behavior of the macro. </p> <div class="mw-heading mw-heading2"><h2 id="Strategies_used_in_languages_that_lack_hygienic_macros">Strategies used in languages that lack hygienic macros</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=5" title="Edit section: Strategies used in languages that lack hygienic macros"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The hygiene problem can be resolved with conventional macros using several alternative solutions. </p> <div class="mw-heading mw-heading3"><h3 id="Obfuscation">Obfuscation</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=6" title="Edit section: Obfuscation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The simplest solution, if temporary storage is needed during macro expansion, is to use unusual variables names in the macro in hope that the same names will never be used by the rest of the program. </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cp">#define INCI(i) { int INCIa = 0; ++i; }</span> <span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">8</span><span class="p">;</span> <span class="w"> </span><span class="n">INCI</span><span class="p">(</span><span class="n">a</span><span class="p">);</span> <span class="w"> </span><span class="n">INCI</span><span class="p">(</span><span class="n">b</span><span class="p">);</span> <span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"a is now %d, b is now %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">);</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div> <p>Until a variable named <code>INCIa</code> is created, this solution produces the correct output: </p> <pre>a is now 5, b is now 9 </pre> <p>The problem is solved for the current program, but this solution is not robust. The variables used inside the macro and those in the rest of the program have to be kept in sync by the programmer. Specifically, using the macro <code>INCI</code> on a variable <code>INCIa</code> is going to fail in the same way that the original macro failed on a variable <code>a</code>. </p> <div class="mw-heading mw-heading3"><h3 id="Temporary_symbol_creation"><span class="anchor" id="Gensym"></span> Temporary symbol creation</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=7" title="Edit section: Temporary symbol creation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In some programming languages, it is possible for a new variable name, or symbol, to be generated and bound to a temporary location. The language processing system ensures that this never clashes with another name or location in the execution environment. The responsibility for choosing to use this feature within the body of a macro definition is left to the programmer. This method was used in <a href="/wiki/MacLisp" class="mw-redirect" title="MacLisp">MacLisp</a>, where a function named <code>gensym</code> could be used to generate a new symbol name. Similar functions (usually named <code>gensym</code> as well) exist in many Lisp-like languages, including the widely implemented <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a> standard<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> and <a href="/wiki/Elisp" class="mw-redirect" title="Elisp">Elisp</a>. </p><p>Although symbol creation solves the variable shadowing issue, it does not directly solve the issue of function redefinition.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> However, <code>gensym</code>, macro facilities, and standard library functions are sufficient to embed hygienic macros in an unhygienic language.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Read-time_uninterned_symbol">Read-time uninterned symbol</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=8" title="Edit section: Read-time uninterned symbol"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>This is similar to obfuscation in that a single name is shared by multiple expansions of the same macro. Unlike an unusual name, however, a read time uninterned symbol is used (denoted by the <code>#:</code> notation), for which it is impossible to occur outside of the macro, similar to <code>gensym</code>. </p> <div class="mw-heading mw-heading3"><h3 id="Packages">Packages</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=9" title="Edit section: Packages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Using packages such as in Common Lisp, the macro simply uses a private symbol from the package in which the macro is defined. The symbol will not accidentally occur in user code. User code would have to reach inside the package using the double colon (<code>::</code>) notation to give itself permission to use the private symbol, for instance <code>cool-macros::secret-sym</code>. At that point, the issue of accidental lack of hygiene is moot. Furthermore the ANSI Common Lisp standard categorizes redefining standard functions and operators, globally or locally, as invoking <a href="/wiki/Undefined_behavior" title="Undefined behavior">undefined behavior</a>. Such usage can be thus diagnosed by the implementation as erroneous. Thus the Lisp package system provide a viable, complete solution to the macro hygiene problem, which can be regarded as an instance of name clashing. </p><p>For example, in the <a href="#Program-defined_function_redefinition">program-defined function redefinition example</a>, the <code>my-unless</code> macro can reside in its own package, where <code>user-defined-operator</code> is a private symbol in that package. The symbol <code>user-defined-operator</code> occurring in the user code will then be a different symbol, unrelated to the one used in the definition of the <code>my-unless</code> macro. </p> <div class="mw-heading mw-heading3"><h3 id="Literal_objects">Literal objects</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=10" title="Edit section: Literal objects"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In some languages the expansion of a macro does not need to correspond to textual code; rather than expanding to an expression containing the symbol <code>f</code>, a macro may produce an expansion containing the actual object referred to by <code>f</code>. Similarly if the macro needs to use local variables or objects defined in the macro's package, it can expand to an invocation of a closure object whose enclosing lexical environment is that of the macro definition. </p> <div class="mw-heading mw-heading2"><h2 id="Hygienic_transformation">Hygienic transformation</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=11" title="Edit section: Hygienic transformation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Hygienic macro systems in languages such as <a href="/wiki/Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a> use a macro expansion process that preserves the lexical scoping of all identifiers and prevents accidental capture. This property is called <a href="/wiki/Referential_transparency" title="Referential transparency">referential transparency</a>. In cases where capture is desired, some systems allow the programmer to explicitly violate the hygiene mechanisms of the macro system. </p><p>For example, Scheme's <code>let-syntax</code> and <code>define-syntax</code> macro creation systems are hygienic, so the following Scheme implementation of <code>my-unless</code> will have the desired behavior: </p> <div class="mw-highlight mw-highlight-lang-scheme mw-content-ltr" dir="ltr"><pre><span></span><span class="p">(</span><span class="k">define-syntax</span><span class="w"> </span><span class="nv">my-unless</span> <span class="w"> </span><span class="p">(</span><span class="k">syntax-rules</span><span class="w"> </span><span class="p">()</span> <span class="w"> </span><span class="p">((</span><span class="k">_</span><span class="w"> </span><span class="nv">condition</span><span class="w"> </span><span class="nv">body</span><span class="w"> </span><span class="o">...</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">not</span><span class="w"> </span><span class="nv">condition</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">begin</span><span class="w"> </span><span class="nv">body</span><span class="w"> </span><span class="o">...</span><span class="p">)))))</span> <span class="p">(</span><span class="k">let</span><span class="w"> </span><span class="p">((</span><span class="nb">not</span><span class="w"> </span><span class="p">(</span><span class="k">lambda</span><span class="w"> </span><span class="p">(</span><span class="nf">x</span><span class="p">)</span><span class="w"> </span><span class="nv">x</span><span class="p">)))</span> <span class="w"> </span><span class="p">(</span><span class="nf">my-unless</span><span class="w"> </span><span class="no">#t</span> <span class="w"> </span><span class="p">(</span><span class="nb">display</span><span class="w"> </span><span class="s">"This should not be printed!"</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="nb">newline</span><span class="p">)))</span> </pre></div> <p>The hygienic macro processor responsible for transforming the patterns of the input form into an output form detects symbol clashes and resolves them by temporarily changing the names of symbols. The basic strategy is to identify <i>bindings</i> in the macro definition and replace those names with gensyms, and to identify <i>free variables</i> in the macro definition and make sure those names are looked up in the scope of the macro definition instead of the scope where the macro was used. </p> <div class="mw-heading mw-heading2"><h2 id="Implementations">Implementations</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=12" title="Edit section: Implementations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Macro systems that automatically enforce hygiene originated with Scheme. The original KFFD algorithm for a hygienic macro system was presented by Kohlbecker in '86.<sup id="cite_ref-hygiene_3-1" class="reference"><a href="#cite_note-hygiene-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> At the time, no standard macro system was adopted by Scheme implementations. Shortly thereafter in '87, Kohlbecker and <a href="/wiki/Mitchell_Wand" title="Mitchell Wand">Wand</a> proposed a declarative pattern-based language for writing macros, which was the predecessor to the <code>syntax-rules</code> macro facility adopted by the R5RS standard.<sup id="cite_ref-r5rs_1-1" class="reference"><a href="#cite_note-r5rs-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> Syntactic closures, an alternative hygiene mechanism, was proposed as an alternative to Kohlbecker et al.'s system by Bawden and Rees in '88.<sup id="cite_ref-syntactic-closures_8-0" class="reference"><a href="#cite_note-syntactic-closures-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> Unlike the KFFD algorithm, syntactic closures require the programmer to explicitly specify the resolution of the scope of an identifier. In 1993, Dybvig et al. introduced the <code>syntax-case</code> macro system, which uses an alternative representation of syntax and maintains hygiene automatically.<sup id="cite_ref-syntax-case_9-0" class="reference"><a href="#cite_note-syntax-case-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> The <code>syntax-case</code> system can express the <code>syntax-rules</code> pattern language as a derived macro. The term <i>macro system</i> can be ambiguous because, in the context of Scheme, it can refer to both a pattern-matching construct (e.g., syntax-rules) and a framework for representing and manipulating syntax (e.g., syntax-case, syntactic closures). </p> <div class="mw-heading mw-heading3"><h3 id="Syntax-rules">Syntax-rules</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=13" title="Edit section: Syntax-rules"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Syntax-rules is a high-level <a href="/wiki/Pattern_matching" title="Pattern matching">pattern matching</a> facility that attempts to make macros easier to write. However, <code>syntax-rules</code> is not able to succinctly describe certain classes of macros and is insufficient to express other macro systems. Syntax-rules was described in the R4RS document in an appendix but not mandated. Later, R5RS adopted it as a standard macro facility. Here is an example <code>syntax-rules</code> macro that swaps the value of two variables: </p> <div class="mw-highlight mw-highlight-lang-scheme mw-content-ltr" dir="ltr"><pre><span></span><span class="p">(</span><span class="k">define-syntax</span><span class="w"> </span><span class="nv">swap!</span> <span class="w"> </span><span class="p">(</span><span class="k">syntax-rules</span><span class="w"> </span><span class="p">()</span> <span class="w"> </span><span class="p">((</span><span class="k">_</span><span class="w"> </span><span class="nv">a</span><span class="w"> </span><span class="nv">b</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">let</span><span class="w"> </span><span class="p">((</span><span class="nf">temp</span><span class="w"> </span><span class="nv">a</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="k">set!</span><span class="w"> </span><span class="nv">a</span><span class="w"> </span><span class="nv">b</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">set!</span><span class="w"> </span><span class="nv">b</span><span class="w"> </span><span class="nv">temp</span><span class="p">)))))</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Syntax-case">Syntax-case</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=14" title="Edit section: Syntax-case"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Due to the deficiencies of a purely <code>syntax-rules</code> based macro system, the <a href="/wiki/R6RS" class="mw-redirect" title="R6RS">R6RS</a> Scheme standard adopted the syntax-case macro system.<sup id="cite_ref-r6rs_10-0" class="reference"><a href="#cite_note-r6rs-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> Unlike <code>syntax-rules</code>, <code>syntax-case</code> contains both a pattern matching language and a low-level facility for writing macros. The former allows macros to be written declaratively, while the latter allows the implementation of alternative frontends for writing macros. The swap example from before is nearly identical in <code>syntax-case</code> because the pattern matching language is similar: </p> <div class="mw-highlight mw-highlight-lang-scheme mw-content-ltr" dir="ltr"><pre><span></span><span class="p">(</span><span class="k">define-syntax</span><span class="w"> </span><span class="nv">swap!</span> <span class="w"> </span><span class="p">(</span><span class="k">lambda</span><span class="w"> </span><span class="p">(</span><span class="nf">stx</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">syntax-case</span><span class="w"> </span><span class="nv">stx</span><span class="w"> </span><span class="p">()</span> <span class="w"> </span><span class="p">((</span><span class="k">_</span><span class="w"> </span><span class="nv">a</span><span class="w"> </span><span class="nv">b</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">syntax</span> <span class="w"> </span><span class="p">(</span><span class="k">let</span><span class="w"> </span><span class="p">((</span><span class="nf">temp</span><span class="w"> </span><span class="nv">a</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="k">set!</span><span class="w"> </span><span class="nv">a</span><span class="w"> </span><span class="nv">b</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">set!</span><span class="w"> </span><span class="nv">b</span><span class="w"> </span><span class="nv">temp</span><span class="p">)))))))</span> </pre></div> <p>However, <code>syntax-case</code> is more powerful than syntax-rules. For example, <code>syntax-case</code> macros can specify side-conditions on its pattern matching rules via arbitrary Scheme functions. Alternatively, a macro writer can choose not to use the pattern matching frontend and manipulate the syntax directly. Using the <code>datum->syntax</code> function, syntax-case macros can also intentionally capture identifiers, thus breaking hygiene. </p> <div class="mw-heading mw-heading3"><h3 id="Other_systems">Other systems</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=15" title="Edit section: Other systems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Other macro systems have also been proposed and implemented for Scheme. Syntactic closures and explicit renaming<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> are two alternative macro systems. Both systems are lower-level than syntax-rules and leave the enforcement of hygiene to the macro writer. This differs from both syntax-rules and syntax-case, which automatically enforce hygiene by default. The swap examples from above are shown here using a syntactic closure and explicit renaming implementation respectively: </p> <div class="mw-highlight mw-highlight-lang-scheme mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">;; syntactic closures</span> <span class="p">(</span><span class="k">define-syntax</span><span class="w"> </span><span class="nv">swap!</span> <span class="w"> </span><span class="p">(</span><span class="nf">sc-macro-transformer</span> <span class="w"> </span><span class="p">(</span><span class="k">lambda</span><span class="w"> </span><span class="p">(</span><span class="nf">form</span><span class="w"> </span><span class="nv">environment</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">let</span><span class="w"> </span><span class="p">((</span><span class="nf">a</span><span class="w"> </span><span class="p">(</span><span class="nf">close-syntax</span><span class="w"> </span><span class="p">(</span><span class="nb">cadr</span><span class="w"> </span><span class="nv">form</span><span class="p">)</span><span class="w"> </span><span class="nv">environment</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="nf">b</span><span class="w"> </span><span class="p">(</span><span class="nf">close-syntax</span><span class="w"> </span><span class="p">(</span><span class="nb">caddr</span><span class="w"> </span><span class="nv">form</span><span class="p">)</span><span class="w"> </span><span class="nv">environment</span><span class="p">)))</span> <span class="w"> </span><span class="o">`</span><span class="p">(</span><span class="k">let</span><span class="w"> </span><span class="p">((</span><span class="nf">temp</span><span class="w"> </span><span class="o">,</span><span class="nv">a</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="k">set!</span><span class="w"> </span><span class="o">,</span><span class="nv">a</span><span class="w"> </span><span class="o">,</span><span class="nv">b</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">set!</span><span class="w"> </span><span class="o">,</span><span class="nv">b</span><span class="w"> </span><span class="nv">temp</span><span class="p">))))))</span> <span class="c1">;; explicit renaming</span> <span class="p">(</span><span class="k">define-syntax</span><span class="w"> </span><span class="nv">swap!</span> <span class="w"> </span><span class="p">(</span><span class="nf">er-macro-transformer</span> <span class="w"> </span><span class="p">(</span><span class="k">lambda</span><span class="w"> </span><span class="p">(</span><span class="nf">form</span><span class="w"> </span><span class="nv">rename</span><span class="w"> </span><span class="nv">compare</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">let</span><span class="w"> </span><span class="p">((</span><span class="nf">a</span><span class="w"> </span><span class="p">(</span><span class="nb">cadr</span><span class="w"> </span><span class="nv">form</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="nf">b</span><span class="w"> </span><span class="p">(</span><span class="nb">caddr</span><span class="w"> </span><span class="nv">form</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="nf">temp</span><span class="w"> </span><span class="p">(</span><span class="nf">rename</span><span class="w"> </span><span class="ss">'temp</span><span class="p">)))</span> <span class="w"> </span><span class="o">`</span><span class="p">(</span><span class="o">,</span><span class="p">(</span><span class="nf">rename</span><span class="w"> </span><span class="ss">'let</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="o">,</span><span class="nv">temp</span><span class="w"> </span><span class="o">,</span><span class="nv">a</span><span class="p">))</span> <span class="w"> </span><span class="p">(</span><span class="o">,</span><span class="p">(</span><span class="nf">rename</span><span class="w"> </span><span class="ss">'set!</span><span class="p">)</span><span class="w"> </span><span class="o">,</span><span class="nv">a</span><span class="w"> </span><span class="o">,</span><span class="nv">b</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="o">,</span><span class="p">(</span><span class="nf">rename</span><span class="w"> </span><span class="ss">'set!</span><span class="p">)</span><span class="w"> </span><span class="o">,</span><span class="nv">b</span><span class="w"> </span><span class="o">,</span><span class="nv">temp</span><span class="p">))))))</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Languages_with_hygienic_macro_systems">Languages with hygienic macro systems</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=16" title="Edit section: Languages with hygienic macro systems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a> – syntax-rules, syntax-case, syntactic closures, and others.</li> <li><a href="/wiki/Racket_(programming_language)" title="Racket (programming language)">Racket</a> – a Scheme variant, its macro system was originally based on syntax-case, but now has more features.</li> <li><a href="/wiki/Nemerle" title="Nemerle">Nemerle</a><sup id="cite_ref-nemerle_12-0" class="reference"><a href="#cite_note-nemerle-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup></li> <li><a href="/wiki/Dylan_(programming_language)" title="Dylan (programming language)">Dylan</a></li> <li><a href="/wiki/Elixir_(programming_language)" title="Elixir (programming language)">Elixir</a><sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup></li> <li><a href="/wiki/Nim_(programming_language)" title="Nim (programming language)">Nim</a></li> <li><a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a></li> <li><a href="/wiki/Haxe" title="Haxe">Haxe</a></li> <li><a href="/wiki/Mary_(programming_language)" title="Mary (programming language)">Mary2</a> – scoped macro bodies in an <a href="/wiki/ALGOL_68" title="ALGOL 68">ALGOL 68</a>-derivative language circa 1978</li> <li><a href="/wiki/Julia_(programming_language)" title="Julia (programming language)">Julia</a><sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup></li> <li><a href="/wiki/Raku_(programming_language)" title="Raku (programming language)">Raku</a> – supports both hygienic and unhygienic macros<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup></li></ul> <div class="mw-heading mw-heading2"><h2 id="Criticism">Criticism</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=17" title="Edit section: Criticism"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Hygienic macros offer safety and referential transparency at the expense of making intentional variable capture less straight-forward. Doug Hoyte, author of <i>Let Over Lambda</i>, writes:<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup> </p> <style data-mw-deduplicate="TemplateStyles:r1244412712">.mw-parser-output .templatequote{overflow:hidden;margin:1em 0;padding:0 32px}.mw-parser-output .templatequotecite{line-height:1.5em;text-align:left;margin-top:0}@media(min-width:500px){.mw-parser-output .templatequotecite{padding-left:1.6em}}</style><blockquote class="templatequote"><p>Almost all approaches taken to reducing the impact of variable capture serve only to reduce what you can do with defmacro. Hygienic macros are, in the best of situations, a beginner's safety guard-rail; in the worst of situations they form an electric fence, trapping their victims in a sanitised, capture-safe prison.</p><div class="templatequotecite">— <cite>Doug Hoyte</cite></div></blockquote> <p>Many hygienic macro systems do offer escape hatches without compromising on the guarantees that hygiene provides; for instance, Racket allows you to define <a rel="nofollow" class="external text" href="https://docs.racket-lang.org/reference/stxparam.html#%28tech._syntax._parameter%29">syntax parameters</a>, which allow you to selectively introduce bound variables. Gregg Hendershott gives an example at Fear of Macros<sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> of implementing an anaphoric if operator in this way. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=18" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Anaphoric_macro" title="Anaphoric macro">Anaphoric macro</a></li> <li><a href="/wiki/Partial_evaluation" title="Partial evaluation">Partial evaluation</a></li> <li><a href="/wiki/Preprocessor" title="Preprocessor">Preprocessor</a></li> <li><a href="/wiki/Syntactic_closure" title="Syntactic closure">Syntactic closure</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=19" title="Edit section: Notes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist reflist-columns references-column-width" style="column-width: 30em;"> <ol class="references"> <li id="cite_note-r5rs-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-r5rs_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-r5rs_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFKelseyClingerReesRozas1998" class="citation journal cs1">Kelsey, Richard; Clinger, William; Rees, Jonathan; et al. (August 1998). <a rel="nofollow" class="external text" href="http://www.schemers.org/Documents/Standards/R5RS/">"Revised<sup>5</sup> Report on the Algorithmic Language Scheme"</a>. <i>Higher-Order and Symbolic Computation</i>. <b>11</b> (1): 7–105. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1023%2FA%3A1010051815785">10.1023/A:1010051815785</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Higher-Order+and+Symbolic+Computation&rft.atitle=Revised%3Csup%3E5%3C%2Fsup%3E+Report+on+the+Algorithmic+Language+Scheme&rft.volume=11&rft.issue=1&rft.pages=7-105&rft.date=1998-08&rft_id=info%3Adoi%2F10.1023%2FA%3A1010051815785&rft.aulast=Kelsey&rft.aufirst=Richard&rft.au=Clinger%2C+William&rft.au=Rees%2C+Jonathan&rft.au=Rozas%2C+G.J.&rft.au=Adams+Iv%2C+N.I.&rft.au=Friedman%2C+D.P.&rft.au=Kohlbecker%2C+E.&rft.au=Steele+Jr.%2C+G.L.&rft.au=Bartley%2C+D.H.&rft_id=http%3A%2F%2Fwww.schemers.org%2FDocuments%2FStandards%2FR5RS%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-dylan-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-dylan_2-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFFeinbergKeeneMatthewsWithington1997" class="citation cs2">Feinberg, N.; Keene, S. E.; Matthews, R. O.; Withington, P. T. (1997), <i>Dylan programming: an object-oriented and dynamic language</i>, Addison Wesley Longman Publishing Co., Inc.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Dylan+programming%3A+an+object-oriented+and+dynamic+language&rft.pub=Addison+Wesley+Longman+Publishing+Co.%2C+Inc.&rft.date=1997&rft.aulast=Feinberg&rft.aufirst=N.&rft.au=Keene%2C+S.+E.&rft.au=Matthews%2C+R.+O.&rft.au=Withington%2C+P.+T.&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-hygiene-3"><span class="mw-cite-backlink">^ <a href="#cite_ref-hygiene_3-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-hygiene_3-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFKohlbeckerFriedmanFelleisenDuba1986" class="citation conference cs1">Kohlbecker, E.; Friedman, D. P.; Felleisen, M.; Duba, B. (1986). <a rel="nofollow" class="external text" href="http://www.cs.indiana.edu/pub/techreports/TR194.pdf">"Hygienic Macro Expansion"</a> <span class="cs1-format">(PDF)</span>. <i>ACM conference on LISP and functional programming</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=conference&rft.atitle=Hygienic+Macro+Expansion&rft.btitle=ACM+conference+on+LISP+and+functional+programming&rft.date=1986&rft.aulast=Kohlbecker&rft.aufirst=E.&rft.au=Friedman%2C+D.+P.&rft.au=Felleisen%2C+M.&rft.au=Duba%2C+B.&rft_id=http%3A%2F%2Fwww.cs.indiana.edu%2Fpub%2Ftechreports%2FTR194.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_gensym.htm#gensym">"CLHS: Function GENSYM"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=CLHS%3A+Function+GENSYM&rft_id=http%3A%2F%2Fwww.lispworks.com%2Fdocumentation%2FHyperSpec%2FBody%2Ff_gensym.htm%23gensym&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?hygiene-versus-gensym">"hygiene-versus-gensym"</a>. <i>community.schemewiki.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">11 June</span> 2022</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=community.schemewiki.org&rft.atitle=hygiene-versus-gensym&rft_id=http%3A%2F%2Fcommunity.schemewiki.org%2F%3Fhygiene-versus-gensym&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFCostanzaD'Hondt2010" class="citation journal cs1">Costanza, Pascal; D'Hondt, Theo (2010). <a rel="nofollow" class="external text" href="https://doi.org/10.3217%2Fjucs-016-02-0271">"Embedding Hygiene-Compatible Macros in an Unhygienic Macro System"</a>. <i>Journal of Universal Computer Science</i>. <b>16</b> (2): 271–295. <a href="/wiki/CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.424.5218">10.1.1.424.5218</a></span>. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.3217%2Fjucs-016-02-0271">10.3217/jucs-016-02-0271</a></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Journal+of+Universal+Computer+Science&rft.atitle=Embedding+Hygiene-Compatible+Macros+in+an+Unhygienic+Macro+System&rft.volume=16&rft.issue=2&rft.pages=271-295&rft.date=2010&rft_id=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fsummary%3Fdoi%3D10.1.1.424.5218%23id-name%3DCiteSeerX&rft_id=info%3Adoi%2F10.3217%2Fjucs-016-02-0271&rft.aulast=Costanza&rft.aufirst=Pascal&rft.au=D%27Hondt%2C+Theo&rft_id=https%3A%2F%2Fdoi.org%2F10.3217%252Fjucs-016-02-0271&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFKohlbeckerWand1987" class="citation conference cs1">Kohlbecker, E.; Wand, M. (1987). <a rel="nofollow" class="external text" href="http://jcmc.indiana.edu/pub/techreports/TR206.pdf">"Macro-by-example: Deriving syntactic transformations from their specifications"</a> <span class="cs1-format">(PDF)</span>. <i>Symposium on Principles of Programming Languages</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=conference&rft.atitle=Macro-by-example%3A+Deriving+syntactic+transformations+from+their+specifications&rft.btitle=Symposium+on+Principles+of+Programming+Languages&rft.date=1987&rft.aulast=Kohlbecker&rft.aufirst=E.&rft.au=Wand%2C+M.&rft_id=http%3A%2F%2Fjcmc.indiana.edu%2Fpub%2Ftechreports%2FTR206.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-syntactic-closures-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-syntactic-closures_8-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBawdenRees1988" class="citation conference cs1">Bawden, A.; Rees, J. (1988). <a rel="nofollow" class="external text" href="https://apps.dtic.mil/dtic/tr/fulltext/u2/a195921.pdf">"Syntactic closures"</a> <span class="cs1-format">(PDF)</span>. <i>Lisp and Functional Programming</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20190903013739/https://apps.dtic.mil/dtic/tr/fulltext/u2/a195921.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on September 3, 2019.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=conference&rft.atitle=Syntactic+closures&rft.btitle=Lisp+and+Functional+Programming&rft.date=1988&rft.aulast=Bawden&rft.aufirst=A.&rft.au=Rees%2C+J.&rft_id=https%3A%2F%2Fapps.dtic.mil%2Fdtic%2Ftr%2Ffulltext%2Fu2%2Fa195921.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-syntax-case-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-syntax-case_9-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFDybvigHiebBruggerman1993" class="citation journal cs1">Dybvig, K; Hieb, R; Bruggerman, C (1993). <a rel="nofollow" class="external text" href="http://www.cs.indiana.edu/~dyb/pubs/LaSC-5-4-pp295-326.pdf">"Syntactic abstraction in Scheme"</a> <span class="cs1-format">(PDF)</span>. <i>LISP and Symbolic Computation</i>. <b>5</b> (4): 295–326. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1007%2FBF01806308">10.1007/BF01806308</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:15737919">15737919</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=LISP+and+Symbolic+Computation&rft.atitle=Syntactic+abstraction+in+Scheme&rft.volume=5&rft.issue=4&rft.pages=295-326&rft.date=1993&rft_id=info%3Adoi%2F10.1007%2FBF01806308&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A15737919%23id-name%3DS2CID&rft.aulast=Dybvig&rft.aufirst=K&rft.au=Hieb%2C+R&rft.au=Bruggerman%2C+C&rft_id=http%3A%2F%2Fwww.cs.indiana.edu%2F~dyb%2Fpubs%2FLaSC-5-4-pp295-326.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-r6rs-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-r6rs_10-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSperberDybvigFlattVan_Straaten2007" class="citation web cs1">Sperber, Michael; Dybvig, R. Kent; Flatt, Matthew; Van Straaten, Anton; et al. (August 2007). <a rel="nofollow" class="external text" href="http://www.r6rs.org">"Revised<sup>6</sup> Report on the Algorithmic Language Scheme (R6RS)"</a>. Scheme Steering Committee<span class="reference-accessdate">. Retrieved <span class="nowrap">2011-09-13</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Revised%3Csup%3E6%3C%2Fsup%3E+Report+on+the+Algorithmic+Language+Scheme+%28R6RS%29&rft.pub=Scheme+Steering+Committee&rft.date=2007-08&rft.aulast=Sperber&rft.aufirst=Michael&rft.au=Dybvig%2C+R.+Kent&rft.au=Flatt%2C+Matthew&rft.au=Van+Straaten%2C+Anton&rft_id=http%3A%2F%2Fwww.r6rs.org&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFClinger1991" class="citation journal cs1">Clinger, Will (1991). "Hygienic macros through explicit renaming". <i>ACM SIGPLAN Lisp Pointers</i>. <b>4</b> (4): 25–28. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F1317265.1317269">10.1145/1317265.1317269</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:14628409">14628409</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=ACM+SIGPLAN+Lisp+Pointers&rft.atitle=Hygienic+macros+through+explicit+renaming&rft.volume=4&rft.issue=4&rft.pages=25-28&rft.date=1991&rft_id=info%3Adoi%2F10.1145%2F1317265.1317269&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A14628409%23id-name%3DS2CID&rft.aulast=Clinger&rft.aufirst=Will&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-nemerle-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-nemerle_12-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSkalskiMoskalOlszta" class="citation cs2">Skalski, K.; Moskal, M; Olszta, P, <a rel="nofollow" class="external text" href="https://web.archive.org/web/20121113081854/http://nemerle.org/metaprogramming.pdf"><i>Metaprogramming in Nemerle</i></a> <span class="cs1-format">(PDF)</span>, archived from <a rel="nofollow" class="external text" href="http://nemerle.org/metaprogramming.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 2012-11-13</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Metaprogramming+in+Nemerle&rft.aulast=Skalski&rft.aufirst=K.&rft.au=Moskal%2C+M&rft.au=Olszta%2C+P&rft_id=http%3A%2F%2Fnemerle.org%2Fmetaprogramming.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://elixir-lang.org/getting-started/meta/macros.html#macros-hygiene">"Macros"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Macros&rft_id=http%3A%2F%2Felixir-lang.org%2Fgetting-started%2Fmeta%2Fmacros.html%23macros-hygiene&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20130504074021/http://docs.julialang.org/en/latest/manual/metaprogramming/#hygiene">"Metaprogramming: the Julia Language"</a>. Archived from <a rel="nofollow" class="external text" href="http://docs.julialang.org/en/latest/manual/metaprogramming/#hygiene">the original</a> on 2013-05-04<span class="reference-accessdate">. Retrieved <span class="nowrap">2014-03-03</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Metaprogramming%3A+the+Julia+Language&rft_id=http%3A%2F%2Fdocs.julialang.org%2Fen%2Flatest%2Fmanual%2Fmetaprogramming%2F%23hygiene&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20140106032143/http://perlcabal.org/syn/S06.html#Macros">"Synopsis 6: Subroutines"</a>. Archived from <a rel="nofollow" class="external text" href="http://perlcabal.org/syn/S06.html#Macros">the original</a> on 2014-01-06<span class="reference-accessdate">. Retrieved <span class="nowrap">2014-06-03</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Synopsis+6%3A+Subroutines&rft_id=http%3A%2F%2Fperlcabal.org%2Fsyn%2FS06.html%23Macros&rfr_id=info%3Asid%2Fen.wikipedia.org%3AHygienic+macro" class="Z3988"></span></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external autonumber" href="https://letoverlambda.com/index.cl/guest/chap3.html#sec_4">[1]</a>, Let Over Lambda—50 Years of Lisp by Doug Hoyte</span> </li> <li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external autonumber" href="https://www.greghendershott.com/fear-of-macros/Syntax_parameters.html">[2]</a>, Fear of Macros</span> </li> </ol></div> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Hygienic_macro&action=edit&section=20" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444"><table class="box-More_footnotes_needed plainlinks metadata ambox ambox-style ambox-More_footnotes_needed" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/40px-Text_document_with_red_question_mark.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/60px-Text_document_with_red_question_mark.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/80px-Text_document_with_red_question_mark.svg.png 2x" data-file-width="48" data-file-height="48" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article includes a list of <a href="/wiki/Wikipedia:Citing_sources#General_references" title="Wikipedia:Citing sources">general references</a>, but <b>it lacks sufficient corresponding <a href="/wiki/Wikipedia:Citing_sources#Inline_citations" title="Wikipedia:Citing sources">inline citations</a></b>.<span class="hide-when-compact"> Please help to <a href="/wiki/Wikipedia:WikiProject_Reliability" title="Wikipedia:WikiProject Reliability">improve</a> this article by <a href="/wiki/Wikipedia:When_to_cite" title="Wikipedia:When to cite">introducing</a> more precise citations.</span> <span class="date-container"><i>(<span class="date">April 2012</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <ul><li><i><a href="/wiki/On_Lisp" title="On Lisp">On Lisp</a></i>, <a href="/wiki/Paul_Graham_(computer_programmer)" class="mw-redirect" title="Paul Graham (computer programmer)">Paul Graham</a></li> <li><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?syntax-rules">syntax-rules on schemewiki</a></li> <li><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?syntax-case">syntax-case on schemewiki</a></li> <li><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?syntax-case-examples">examples of syntax-case on schemewiki</a></li> <li><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?syntactic-closures">syntactic closures on schemewiki</a></li> <li><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?simpler-macros">simpler-macros on schemewiki</a></li> <li><a rel="nofollow" class="external text" href="http://community.schemewiki.org/?simpler-macros-examples">examples of simpler-macros on schemewiki</a></li> <li><a rel="nofollow" class="external text" href="http://www.cs.indiana.edu/~dyb/pubs/tr356.pdf">Writing Hygienic Macros in Scheme with Syntax-Case</a></li></ul> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐f69cdc8f6‐zl2dt Cached time: 20241124130944 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.361 seconds Real time usage: 0.456 seconds Preprocessor visited node count: 1487/1000000 Post‐expand include size: 37676/2097152 bytes Template argument size: 2214/2097152 bytes Highest expansion depth: 13/100 Expensive parser function count: 13/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 76436/5000000 bytes Lua time usage: 0.211/10.000 seconds Lua memory usage: 5742140/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 394.623 1 -total 50.53% 199.405 1 Template:Reflist 28.38% 111.987 4 Template:Cite_journal 21.30% 84.050 1 Template:Short_description 15.56% 61.396 1 Template:Technical 15.16% 59.807 2 Template:Ambox 12.31% 48.587 2 Template:Pagetype 10.11% 39.878 6 Template:Main_other 7.10% 28.026 6 Template:Cite_web 5.85% 23.094 1 Template:Cquote --> <!-- Saved in parser cache with key enwiki:pcache:idhash:373314-0!canonical and timestamp 20241124130944 and revision id 1255215995. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Hygienic_macro&oldid=1255215995">https://en.wikipedia.org/w/index.php?title=Hygienic_macro&oldid=1255215995</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Transformation_languages" title="Category:Transformation languages">Transformation languages</a></li><li><a href="/wiki/Category:Scheme_(programming_language)" title="Category:Scheme (programming language)">Scheme (programming language)</a></li><li><a href="/wiki/Category:Dylan_(programming_language)" title="Category:Dylan (programming language)">Dylan (programming language)</a></li><li><a href="/wiki/Category:Metaprogramming" title="Category:Metaprogramming">Metaprogramming</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Wikipedia_articles_that_are_too_technical_from_November_2016" title="Category:Wikipedia articles that are too technical from November 2016">Wikipedia articles that are too technical from November 2016</a></li><li><a href="/wiki/Category:All_articles_that_are_too_technical" title="Category:All articles that are too technical">All articles that are too technical</a></li><li><a href="/wiki/Category:Articles_lacking_in-text_citations_from_April_2012" title="Category:Articles lacking in-text citations from April 2012">Articles lacking in-text citations from April 2012</a></li><li><a href="/wiki/Category:All_articles_lacking_in-text_citations" title="Category:All articles lacking in-text citations">All articles lacking in-text citations</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 3 November 2024, at 19:33<span class="anonymous-show"> (UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Hygienic_macro&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-f69cdc8f6-98hqk","wgBackendResponseTime":137,"wgPageParseReport":{"limitreport":{"cputime":"0.361","walltime":"0.456","ppvisitednodes":{"value":1487,"limit":1000000},"postexpandincludesize":{"value":37676,"limit":2097152},"templateargumentsize":{"value":2214,"limit":2097152},"expansiondepth":{"value":13,"limit":100},"expensivefunctioncount":{"value":13,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":76436,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 394.623 1 -total"," 50.53% 199.405 1 Template:Reflist"," 28.38% 111.987 4 Template:Cite_journal"," 21.30% 84.050 1 Template:Short_description"," 15.56% 61.396 1 Template:Technical"," 15.16% 59.807 2 Template:Ambox"," 12.31% 48.587 2 Template:Pagetype"," 10.11% 39.878 6 Template:Main_other"," 7.10% 28.026 6 Template:Cite_web"," 5.85% 23.094 1 Template:Cquote"]},"scribunto":{"limitreport-timeusage":{"value":"0.211","limit":"10.000"},"limitreport-memusage":{"value":5742140,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-f69cdc8f6-zl2dt","timestamp":"20241124130944","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Hygienic macro","url":"https:\/\/en.wikipedia.org\/wiki\/Hygienic_macro","sameAs":"http:\/\/www.wikidata.org\/entity\/Q17157225","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q17157225","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2003-11-20T14:47:08Z","dateModified":"2024-11-03T19:33:39Z","headline":"programming macro whose expansion is guaranteed not to cause the capture of identifiers"}</script> </body> </html>