Nevermind. I was making things way too complicated. Obviously I can just return #'(pattern) in the event I'd like the caller's procedure invoked.
Thanks. On Wed, Apr 17, 2013 at 11:29 AM, Scott Klarenbach <sc...@pointyhat.ca>wrote: > Hi there, > > With my limited macro knowledge I'm trying to accomplish the following: > > Create a macro that accepts custom dsl-ish syntax. In addition to the > custom syntax, a user can also provide a procedure. > > For example: > > (my-macro [(name:first-name type:string required:#t) > (name:last-name type:string) > (hash 'id middle-name 'type 'string) > (lambda () (do-something-arbitrary))]) > > The first two are the dsl, the next two are procedures. The macro > converts the shorthand key:val syntax into hashes internally and does some > other processing. So far, so good. > > But additionally I'd like to invoke any provided procedure (any datum that > doesn't match the dsl syntax) in lieu of the short-hand syntax. > > What's the "correct" way to invoke the procedures, since I'm sure I'm > doing it wrong. > > So far, I'm converting each syntax expression that's not in the dsl using > syntax-datum. But then they're quoted, and I have to use eval, which > imposes a bunch of namespace complexity. Is there a way to invoke syntax > without eval? Or is there a much better way entirely to write the macro so > that the above would work? > > Thanks. > > > -- > Talk to you soon, > > Scott Klarenbach > > PointyHat Software Corp. > www.pointyhat.ca > p 604-568-4280 > e sc...@pointyhat.ca > 200-1575 W. Georgia > Vancouver, BC V6G2V3 > > _______________________________________ > To iterate is human; to recur, divine > -- Talk to you soon, Scott Klarenbach PointyHat Software Corp. www.pointyhat.ca p 604-568-4280 e sc...@pointyhat.ca 200-1575 W. Georgia Vancouver, BC V6G2V3 _______________________________________ To iterate is human; to recur, divine
____________________ Racket Users list: http://lists.racket-lang.org/users