12.8 Syntax Taints

► |  | The Racket Reference

1 | Language Model
2 | Notation for Documentation
3 | Syntactic Forms
4 | Datatypes
5 | Structures
6 | Classes and Objects
7 | Units
8 | Contracts
9 | Pattern Matching
10 | Control Flow
11 | Concurrency and Parallelism
12 | Macros
13 | Input and Output
14 | Reflection and Security
15 | Operating System
16 | Memory Management
17 | Unsafe Operations
18 | Running Racket
| Bibliography
| Index

▼ | 12 | Macros

12.1 | Pattern-Based Syntax Matching
12.2 | Syntax Object Content
12.3 | Syntax Object Bindings
12.4 | Syntax Transformers
12.5 | Syntax Parameters
12.6 | Local Binding with Splicing Body
12.7 | Syntax Object Properties
12.8 | Syntax Taints
12.9 | Expanding Top-Level Forms
12.10 | Serializing Syntax
12.11 | File Inclusion
12.12 | Syntax Utilities
12.13 | Phase and Space Utilities

On this page:

syntax-tainted?
syntax-arm
syntax-protect
syntax-disarm
syntax-rearm
syntax-taint

top contents ← prev up next →

#### 12.8`` Syntax Taints🔗ℹ

> > > 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 stx key) 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 [inspector use-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 stx inspector) → 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 stx from-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 contents ← prev up next →