{"size": 1660, "ext": "scrbl", "max_stars_repo_path": "share/pkgs/racket-doc/scribblings/guide/macros.scrbl", "max_stars_repo_name": "takikawa/racket-ppa", "max_stars_repo_stars_event_min_datetime": "2018-07-29T04:13:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:11:17.000Z", "max_issues_repo_path": "share/pkgs/racket-doc/scribblings/guide/macros.scrbl", "max_issues_repo_name": "takikawa/racket-ppa", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "share/pkgs/racket-doc/scribblings/guide/macros.scrbl", "max_forks_repo_name": "takikawa/racket-ppa", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 10, "max_issues_count": 15, "max_forks_count": null, "avg_line_length": 42.5641025641, "max_line_length": 104, "alphanum_fraction": 0.7578313253}
#lang scribble/doc
@(require scribble/manual scribble/eval "guide-utils.rkt")

@title[#:tag "macros" #:style 'toc]{Macros}

A @deftech{macro} is a syntactic form with an associated
@deftech{transformer} that @deftech{expands} the original form
into existing forms. To put it another way, a macro is an
extension to the Racket compiler. Most of the syntactic forms of
@racketmodname[racket/base] and @racketmodname[racket] are
actually macros that expand into a small set of core constructs.

Like many languages, Racket provides pattern-based macros that
make simple transformations easy to implement and reliable to
use. Racket also supports arbitrary macro transformers that are
implemented in Racket---or in a macro-extended variant of Racket.

This chapter provides an introduction to Racket macros, but see
@hyperlink["https://www.greghendershott.com/fear-of-macros/"]{@italic{Fear of
Macros}} for an introduction from a different perspective.

Racket includes additional support for macro development:
A @hyperlink["https://docs.racket-lang.org/macro-debugger/index.html"]{@italic{macro
debugger}} to make it easier for experienced programmers
to debug their macros and for novices to study their behavior,
and of macros. And the @hyperlink["https://docs.racket-lang.org/syntax/index.html"]{@italic{syntax/parse
library}} for writing macros and specifying syntax that
automatically validates macro uses and reports syntax
errors.

@local-table-of-contents[]

@;------------------------------------------------------------------------
@include-section["pattern-macros.scrbl"]
@include-section["proc-macros.scrbl"]
@include-section["macro-module.scrbl"]


