12 Macros
On this page:
top
up

12.8Syntax TaintsπŸ”— i

+Tainted Syntax in The Racket Guide introduces syntax taints.

A tainted identifier is rejected by the macro expander for use as either a binding or expression. If a syntax object stx is tainted, then any syntax object in the result of (syntax-e stx) is tainted, and datum->syntax with stx as its first argument produces a tainted syntax object. Any syntax object in the result of (syntax-property stxkey) is also tainted if it is in a position within the value that would be reached by datum->syntax ’s conversion. Taints cannot be removed.

A syntax object is tainted when it is included in an exception by the macro expander or when it is produced by a function like expand using a code inspector that is not the original code inspector. The function syntax-taint also returns a tainted syntax object.

Previous versions of Racket included a notion of arming and disarming syntax to trigger taints or avoid taints. That indirection is no longer supported, and the operations syntax-arm , syntax-disarm , syntax-rearm , and syntax-protect now have no effect on their arguments. Along similar lines, the syntax properties (see Syntax Object Properties) 'taint-mode and 'certify-mode were formerly used to control syntax arming and are no longer specifically recognized by the macro expander.

procedure

(syntax-tainted? stx)boolean?

stx:syntax?
Returns #t if stx is tainted, #f otherwise.

procedure

(syntax-arm stx[inspectoruse-mode?])syntax?

stx:syntax?
inspector:(or/c inspector? #f)=#f
use-mode?:any/c =#f
Returns stx.

Changed in version 8.2.0.4 of package base: Changed to just return stx instead of returning “armed” syntax.

procedure

( syntax-protect stx)syntax?

stx:syntax?
Returns stx.

Changed in version 8.2.0.4 of package base: Changed to just return stx instead of returning “armed” syntax.

procedure

(syntax-disarm stxinspector)syntax?

stx:syntax?
inspector:(or/c inspector? #f)
Returns stx.

Changed in version 8.2.0.4 of package base: Changed to just return stx instead of potentially “disarming” syntax.

procedure

(syntax-rearm stxfrom-stx[use-mode?])syntax?

stx:syntax?
from-stx:syntax?
use-mode?:any/c =#f
Returns stx.

Changed in version 8.2.0.4 of package base: Changed to just return stx instead of potentially “arming” syntax.

procedure

(syntax-taint stx)syntax?

stx:syntax?
Returns tainted version of stx, which is stx if it is already tainted.

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /