A deprecated function, macro, or other API element is one that’s been formally declared obsolete, typically with an intended replacement that users should migrate to. The racket/deprecation library provides a standardized mechanism for declaring deprecations in a machine-processable manner. These declarations can allow tools such as resyntax to automate migrating code away from deprecated APIs. Note that a dependency on the racket/deprecation library does not imply a dependency on any such tools.
syntax
( define-deprecated-alias alias-idtarget-id)
Note that although alias-id is an alias of target-id, it is not considered the same binding as target-id and is not free-identifier=? . This is because the alias binding must be inspectable at compile-time with deprecated-alias? and deprecated-alias-target , and it must remain inspectable even if the alias is provide d by a module. This requires a module providing the alias and the target to provide them as two distinct bindings: one which is bound to a deprecated alias transformer and one which isn’t.
> legacy-a42
The racket/deprecation/transformer module provides compile-time supporting code for the racket/deprecation library, primarily for use in tools that wish to reflect on deprecated code.
A deprecated alias transformer is a kind of rename transformer which signals that the transformer binding is a deprecated alias of the target identifier. This signal is intended for consumption in tools such as editors (which may wish to display a warning when deprecated aliases are used) and automated refactoring systems (which may wish to replace deprecated aliases with their target identifiers automatically).
procedure
v:any/c
racket/deprecation/transformer)racket/deprecationsyntax/parse/define)'result)#f
> (is-deprecated?bad-list)#t
procedure
( deprecated-alias target)→deprecated-alias?
target:identifier?
This constructor is not intended for direct use by users who just want to declare a deprecated alias. Such users should prefer the define-deprecated-alias form instead.
procedure
( deprecated-alias-target alias)→identifier?
alias:deprecated-alias?