> On Oct 25, 2016, at 17:27, Ryan Culpepper <ry...@ccs.neu.edu> wrote:
> 
> Consider that (eval (list 'quote #'+)) also evaluates to a symbol, for about 
> the same reason.

Yes, this does make sense, even if I couldn’t put it quite so nicely. :)

> Try local-expanding either of these terms instead:
> 
>  #`(let-syntax ([x (λ (stx)
>                      (syntax-property #'(void) 'prop
>                                       (prefab-box #'add1)))])
>      x)
> 
> or
> 
>  #`(let-syntax ([x (λ (stx)
>                       #'#,(syntax-property #'(void) 'prop
>                                            (prefab-box #'add1)))])
>       x)
> 
> and the box will have an identifier in it.

I can’t quite do either of these, unfortunately, since in my case, I
need to defer attaching the syntax property until `x` is actually used
(I apply an instantiate-type function to the prefab struct value at each
use site), and the prefab struct value itself is not known ahead of time
(it is produced by another function, and it can be a relatively complex
structure).

The approach I’ve taken so far is the cheat with the piece of “proxy”
syntax, which is closer to your second example, since it uses syntax
properties to circumvent evaluation. It causes the issue mentioned at
the beginning of this thread, though.

It seems like perhaps, in theory, I could come up with a function
prefab->expression which would take a prefab struct value and produce a
syntax object containing an expression that would evaluate to the same
thing, but this is not only an extremely ugly hack but one that won’t
work unless I know all the different kinds of prefab structs ahead of
time (and I would like users to be able to use arbitrary ones). So I
feel a bit stuck.

-- 
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