combine-out may help simplify things?

(define-syntax my-out
  (make-provide-transformer
   (lambda (stx modes)
     (syntax-parse stx
       ((_ name:id)
        #:with mk-name (format-id #'name "make-~a" #'name)
        (expand-export #'(combine-out name mk-name) modes))))))

or

(define-provide-syntax my-out
  (syntax-parser
    [(_ name:id)
     #:with mk-name (format-id #'name "make-~a" #'name)
     #'(combine-out name mk-name)]))


On Fri, Mar 10, 2017 at 1:25 PM, Dan Liebgold
<dan_liebg...@naughtydog.com> wrote:
> Hi -
>
> I'd like to create a new provide syntax that essentially turns this:
>
>   (provide (my-out name))
>
> into this:
>
>   (provide name make-name)
>
> where 'name' and 'make-name' are defined in the surrounding context. It looks 
> like define-provide-syntax isn't up to the task, so I used 
> 'make-provide-transformer' directly, like so:
>
> (define-syntax my-out
>   (make-provide-transformer
>    (lambda (stx modes)
>      (syntax-parse stx
>        ((_ name:id)
>         (let ([nt #'name]
>               [c (format-id #'name "make-~a" (syntax-e #'name))])
>           (list (make-export nt (syntax-e nt) 0 #f nt)
>                 (make-export c (syntax-e c) 0 #f c)
>                                 )))))))
>
>
> Is there a more concise way of doing this?
>
> Thanks,
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to