8.18
top
← prev up next →

Static RenamingπŸ”— i

syntax

( static-rename name-idexpr)

Equivalent to expr, but adjusts the statically inferred name for expr so that (syntax-local-name ) produces 'name-id while expanding expr. This allows adjusting the names of things like procedures, which infer their runtime names based on static information. Unlike procedure-rename , however, static-rename does not introduce any additional runtime cost.

For more information, see Inferred Value Names.

Examples:
> (define f(λ (x)x))
> f

#<procedure:f>

> (define g(static-rename renamed(λ (x)x)))
> g

#<procedure:renamed>

syntax

( define/renamed name-ididexpr)

(define/renamed name-id(headargs)body...+)
head = id
| (headargs)
args = arg...
| arg....rest-id
arg = arg-id
| [arg-iddefault-expr]
| keywordarg-id
| keyword[arg-iddefault-expr]
Defines a binding, just like define , but expr is statically renamed using static-rename . Also like define , define/renamed is a shorthand form for defining a function, which will use name-id for the runtime name produced by object-name .

Examples:
> (define/renamed bar(foox)
(* 2x))
> (foo3)

6

> foo

#<procedure:bar>

> (object-name foo)

'bar

top
← prev up next →

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