diff --git a/collects/unstable/scribblings/syntax.scrbl b/collects/unstable/scribblings/syntax.scrbl index 6aa7b20fda..02b3530830 100644 --- a/collects/unstable/scribblings/syntax.scrbl +++ b/collects/unstable/scribblings/syntax.scrbl @@ -238,6 +238,17 @@ in the argument list are automatically converted to symbols. the second error but not of the first.) } +@margin-note{This binding was added by Vincent St-Amour.} +@defproc[(format-unique-id [lctx (or/c syntax? #f)] + [#:source src (or/c syntax? #f) #f] + [#:props props (or/c syntax? #f) #f] + [#:cert cert (or/c syntax? #f) #f] + [fmt string?] + [v (or/c string? symbol? identifier? keyword? char? number?)] ...) + identifier?]{ +Like @racket[format-id], but returned identifiers are guaranteed to be unique. +} + @defproc[(internal-definition-context-apply [intdef-ctx internal-definition-context?] [stx syntax?]) syntax?]{ diff --git a/collects/unstable/syntax.rkt b/collects/unstable/syntax.rkt index ec2fbc0f60..e8d4033108 100644 --- a/collects/unstable/syntax.rkt +++ b/collects/unstable/syntax.rkt @@ -1,5 +1,5 @@ #lang racket/base -;; owner: ryanc (and cce, where noted) +;; owner: ryanc (and cce and stamourv, where noted) (require syntax/kerncase syntax/stx unstable/struct @@ -49,6 +49,10 @@ syntax-list + ;; by stamourv: + + format-unique-id + ) ;; Unwrapping syntax @@ -383,3 +387,12 @@ (call-with-composable-continuation body trampoline-prompt-tag) (void)) + +(define (format-unique-id lctx + #:source [src #f] + #:props [props #f] + #:cert [cert #f] + fmt . args) + ((make-syntax-introducer) (apply format-id + lctx #:source src #:props props #:cert cert + fmt args)))