Skip to content

Add deprecated aliases #5251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

jackfirth
Copy link
Contributor

This pull request adds a deprecated-alias rename transformer and a (define-deprecated-alias alias-id target-id) macro, which exports alias-id as an alias of target-id.

Checklist

  • Feature
  • tests included
  • documentation
  • identify aliases in the standard library

Description of change

The define-deprecated-alias macro provides alias-id as a rename transformer that expands to target-id. It allows external tools to use syntax-local-value/immediate on uses of alias-id to determine that it's a deprecated alias and what identifier to use instead.

This feature is intended for use in Typed Racket and Resyntax, as Typed Racket has several macros like struct:, for:, etc. that are legacy aliases for non-colon-suffixed equivalents like struct and for. Providing a standardized mechanism for defining deprecated aliases allows library authors to coerce Resyntax into automatically migrating client code when a library renames something. A full audit of main-distribution use cases remains to be performed, as there are likely other packages besides TR that could make use of this feature.

@jackfirth jackfirth added api design Related to the design of core libraries and language features macro system Expander, Syntax Parse, other #lang racket macros labels Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api design Related to the design of core libraries and language features macro system Expander, Syntax Parse, other #lang racket macros
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant