On Thu, Feb 18, 2016 at 3:06 AM, Alexis King <lexi.lam...@gmail.com> wrote: > I have a macro that creates a transformer binding. This binding has > prop:procedure on it, so when used, it functions as a macro and expands > into something else. This works great, but I have another requirement: > when this binding is provided, I actually want to provide an entirely > different value in its place. > > Initially, I tried to accomplish this by attaching > prop:provide-transformer to my value, but that property is not consulted > when the provided identifier is being used as a bare identifier instead > of in a function call-like form. I understand the general reasoning > behind this — most of the time, provide transformers are used as > abbreviations for other provide forms — but in my case, I want to > leverage the provide transformer mechanism to actually provide something > different in place of the binding. > > The reason I want to do this is complex, and I am willing to explain it > if requested, but my need is simply that I want the ability to > automatically substitute a value at the module boundary. Any way to > accomplish this would be okay, including possibly adjusting my > prop:procedure value to conditionally expand into different things > depending on whether or not the identifier is being used from within the > declaring module, but I would much prefer a way to do it at provide-time > if at all possible. > > It seems that possibly Typed Racket’s identifiers somehow do something > similar, though not quite the same? That is, they are provided with > contracts when used in an untyped module but provided bare when used in > another typed module? Could that approach be used here, and if so, how > is that implemented (in broad strokes)?
I thought that they were set!-transformers that look something like this... (lambda (stx) (if in-typed-racket? expand-to-contract expand-to-self)) Jay > Thanks, > Alexis > > -- > 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. -- Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io "Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great." - D&C 64:33 -- 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.