[racket] How to get a shared environment in different modules in compile time
Sam,
Thank you for the references. I will read them shortly.
For now, I got away with a macro-generating macro:
(define-syntax (def-with-comment stx)
(syntax-case stx ()
((_ (name comment . params) . body)
#'(begin
(begin-for-syntax
(hash-set! comments (syntax->datum #'name) (syntax->datum
#'comment)))
(define (name . params) . body)))))
On 09/25/2013 04:09 PM, Sam Tobin-Hochstadt wrote:
> On Wed, Sep 25, 2013 at 6:59 AM, Dmitry Pavlov <dpavlov at ipa.nw.ru> wrote:
>>
>> However, I do not see how to fix that. Does anybody?
>> What is the recommended way to do that sort of thing in Racket?
>
> This turns out to be a subtle issue, but one we've thought a lot
> about. The best way to learn about how we do this in Racket is a few
> papers that Matthew, Ryan, and I have written over the years:
>
> Languages as Libraries, PLDI 2011:
> http://www.ccs.neu.edu/racket/pubs/pldi11-thacff.pdf
>
> This covers a lot of ground, and at a fairly high level, but it will
> introduce the idea -- see section 6.2
>
> Advanced Macrology ..., Scheme 2007:
> http://www.ccs.neu.edu/racket/pubs/scheme2007-ctf.pdf
>
> This paper focuses more on the issue you're interested in --- see
> section 3.2.3 in particular
>
> Composable and Compilable Macros, ICFP 2002:
> http://www.cs.utah.edu/plt/publications/macromod.pdf
>
> This paper introduces all the big ideas about the module system, but
> is probably harder for someone new to this to learn from.
>
> I'd start with the 'Advanced Macrology' paper, and look at the others,
> or post here again, if you get confused.
>
> Sam
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>