[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use & imports
Miles Egan <miles@caddr.com> writes:
> Is there any way to use a module without dumping all of its exports into
> the local namespace? Generally I prefer to use explicit namespace
> prefixes.
>
> miles
A while back I added use/mangle. Assuming it hasn't gone away, my
original post still holds. I think that provides what you want. It
goes a little something like this:
-----
Anonymous CVS (see info at Wiki) now has use/mangle support checked
in. This is relevant for those of you who want to do things like:
(use/mangle tests/manglea a:)
(use/mangle tests/mangleb b:)
(a:func-a)
(a:func-b)
(b:func-a)
(b:func-b)
All it does is import everything exported by the module in question,
but with the given prefix mangled on to the binding name.
For those who were desiring module:binding, this is equivalent to what
you wanted, although it's usable for other things too. For example,
you could also bind on "mail-" instead, or something like that.
This should help deal with the instinct of prefixing method names
yourself, out of a fear of name collisions. (Eg, earlier I found
myself prefixing "mail-" onto functions just because I was concerned
about binding collisions with something more important.) Note that I
am one of those people would ideally like a unified generic system
without the constraints on the number of parameters, but this is a
useful thing regardless, and very helpful in the short term.
-----
Andrew