[plt-scheme] enclosing-module-name

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Apr 4 14:31:25 EDT 2007

Here is how I'd use it:

(module test mzscheme

   (define-syntax (test-module-name stx)
     (syntax-case stx ()
       ((_ x)
        (let ((prop (syntax-property stx 'enclosing-module-name)))
          #`(#%module-begin (display (quote #,prop)))))))

   (provide
    [all-from-except mzscheme #%module-begin]
    [rename test-module-name #%module-begin]))

(module imp test

   1)

(require imp)

See help desk: 'enclosing-module-name is attached when #%module-begin  
is wrapped around module body.

-- Matthias



On Apr 4, 2007, at 8:27 AM, support at taxupdate.com wrote:

> (module test mzscheme
>   (provide (all-defined))
>   (define-syntax (test-module-name stx)
>       (syntax-case stx ()
>         ((_)
>          (let ((prop (syntax-property stx 'enclosing-module-name)))
>            #`(printf "~a\n" #,prop))))))



Posted on the users mailing list.