3.27 Unsafe Access to Core Compiler Forms

► |  | 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

▼ | 3 | Syntactic Forms

3.1 | Modules: module, module*, ...
3.2 | Importing and Exporting: require and provide
3.3 | Literals: quote and #%datum
3.4 | Expression Wrapper: #%expression
3.5 | Variable References and #%top
3.6 | Locations: #%variable-reference
3.7 | Procedure Applications and #%app
3.8 | Procedure Expressions: lambda and case-lambda
3.9 | Local Binding: let, let*, letrec, ...
3.10 | Local Definitions: local
3.11 | Constructing Graphs: shared
3.12 | Conditionals: if, cond, and, and or
3.13 | Dispatch: case
3.14 | Definitions: define, define-syntax, ...
3.15 | Sequencing: begin, begin0, and begin-for-syntax
3.16 | Guarded Evaluation: when and unless
3.17 | Assignment: set! and set!-values
3.18 | Iterations and Comprehensions: for, for/ list, ...
3.19 | Continuation Marks: with-continuation-mark
3.20 | Quasiquoting: quasiquote, unquote, and unquote-splicing
3.21 | Syntax Quoting: quote-syntax
3.22 | Interaction Wrapper: #%top-interaction
3.23 | Blocks: block
3.24 | Internal-Definition Limiting: #%stratified-body
3.25 | Performance Hints: begin-encourage-inline
3.26 | Importing Modules Lazily: lazy-require
3.27 | Unsafe Access to Core Compiler Forms

On this page:

#%foreign-inline

Racket
top contents ← prev up next →

### 3.27 Unsafe Access to Core Compiler Forms🔗ℹ

> syntax (#%foreign-inline datum maybe-mode)
> maybe-mode |  | = |  |
> |  | | |  | #:effect
> |  | | |  | #:pure
> |  | | |  | #:pure*
> |  | | |  | #:copy
> |  | | |  | #:copy*

The #%foreign-inline form unsafely inlines an expression form that is supported by the core compiler and runtime system that Racket runs on, which is Chez Scheme in the case of Racket CS. Omitting maybe-mode is equivalent to supplying #:effect.

Ensuring that datum is supported and has appropriate behavior (consistent with maybe-mode) is up to the user of this form:

- The datum must not refer to any variable that is bound in the enclosing scope.

- Evaluating datum must not raise an exception or otherwise inspect the current continuation, and it must return a single value.

- If #:pure or #:copy is specified, then evaluating datum must not have any side effects or depend on preceding effects.

- If #:pure* or #:copy* is specified, then not only must evaluating datum have no side effects or dependencies on preceding effects, the expression must be applied to arguments where the application has no side effects or dependencies on preceding effects.

- If #:copy or #:copy* is specified, then the compilation may duplicate the entire (#%foreign-inline datum maybe-mode) expression one or more times to inline its implementation at different uses of its value.

Added in version 9.1.0.8 of package base.

top contents ← prev up next →