[racket] current-module-declare-name

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Aug 22 18:23:16 EDT 2013

You're unlikely to see a non-`#f` value for that parameter. The
parameter is set by the module loader while a module file is being
loaded, which includes when the module is declared ---- but declaration
and instantiation are distinct. The time that code runs within a module
is instantiation time, which is after the module is declared and after
the parameter has been unset.

If you want to get the name of an enclosing module, then the
`syntax/location' module provides various forms that might be what you
want, such as `quote-module-name'.

More primitively, various `variable-reference->...' functions are
available, such as

 (variable-reference->resolved-module-path (#%variable-reference))

The `#%variable-reference' form was originally for a different purpose,
which is why it has such a weird name. It has evolved to generally
serve as a bridge between declaration-time information and run-time
evaluation. Forms like `quote-module-name' are built on variable
references.


At Thu, 22 Aug 2013 16:09:13 -0600, Christopher wrote:
> (current-module-declare-name) seems to always return #f. 
> 
> It does this both when I run it from the REPL, when it run it from an unsaved 
> file, and when I run it from a saved file.
> 
> Is this function performing properly? Under what circumstances should it return 
> #f?
> 
> Just so you know, I have canvased the documentation for this function several 
> times, but it's described behavior still doesn't seem to match what I'm 
> observing.
> 
> Any help would be appreciated.  Thanks!
> 
> --Christopher____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.