On 2009-10-15, at 1:11 AM, Arthur A. Gleckler wrote:

>> I am not the (or even an) implementer, but I believe that "module"
>> in Chicken is not a macro, but primitive syntax.  All it does is to
>> make any definitions use magic names of the form "modname#truename".
>> When the module is imported, the "modname#truename" names are located
>> and aliases are constructed for them in the current context.
>
> Interesting.  It seems like this concept of alias might be something
> that could form part of a useful substrate for modules.

For the record, Gambit also provides something similar with the  
"##namespace" declaration.  It provides "automatic prefixing" with a  
namespace prefix, for a given set of free identifier, or for all free  
identifier.  For example:

   (##namespace ("foo#"))  ;; every identifier is prefixed with foo#
   (##namespace ("" + define))  ;; except + and define
   (##namespace ("bar#" f))  ;; and f which is prefixed with bar#
   (define (f x) (+ x a other#b))

is equivalent to

   (define (bar#f x) (+ x foo#a other#b))

Note that an identifier containing a #, such as other#b and  
##namespace, remains as is (think of it as a "fully qualified  
identifier").

Marc


_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to