At Thu, 9 May 2019 00:15:43 +0300, Dmitry Pavlov wrote:
> 
> On 5/9/19 12:04 AM, Dmitry Pavlov wrote:
> > Matthew,
> >
> >
> >> The intended error here is "cannot marshal value that is embedded in
> >> compiled code" at `raco make` time, because fxvectors are not supported
> >> as literals. I'll fix the bytecode writer to check for this case.
> >
> > OK, thank you. What would you recommend, though, to users who want 
> > fxvectors 
> (of "static" kind) to be generated by macros?
> > Populating fxvectors in runtime will be a loss of performance, maybe not 
> critical, but noticeable.
> 
> Ah, I see
> 
> #lang racket
> 
> (require (for-syntax syntax/parse))
> (require  racket/fixnum)
> 
> (define-syntax (macro stx)
>    (syntax-parse stx
>      (({~literal macro})
>       (quasisyntax/loc stx
>         (begin
>           (define v-name (fxvector 5))
>           'OK)))))
> 
> (macro)
> 
> 
> So I should put fxvector non-literals inside the syntax, and everything will 
> be fine.

Yes. Or if the macro is used in a potentially nested expression context
and you want to make sure that the fxvector is created once, you can
use `syntax-local-lift-expression`.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5cd349b3.1c69fb81.28f6f.0320SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to