The core actually wouldn't have to be modified, as it already does
something similar. After all, the function 'use' already does it - if
we 'use' error-kit, it adds to the symbol map (seen by (ns-refers
*ns*)) a map from the symbol to the actual var in error-kit. Thus, in
ns A where we have used error kit, evaluating #'handle  will actually
give us as a return value of #'clojure.contrib.error-kit/handle
because the symbol handle refers to the other ns's var.

The only problem is the import one - 'use' only imports vars which
actually belong to the ns you are using. We want it to not only import
public vars, but also to 'refer' certain vars which we also want to
export. So, the simple solution would be to tag the symbol in our ns
with special metadata, maybe an 'export' key, and then write another
function which does what 'use' does but also refers vars which have
the 'export' metadata.

Personally, i think the use function in the core should be rewritten
to consider two things when importing vars:
(1) if the symbol belongs to the ns you are using, then refer it
(2) if the symbol has  :export in the symbols metadata, then also
refer it.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to