[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do-xxx-symbols



I had forgotten that you wrote the chapter.  I think that for the
author of a section to say "this is what I meant" is as authoritative
as we can reasonably expect.  The only way I can see to guarantee only
one occurence, and no shadowed symbols is to hash each symbol before
passing it to the user.  We did that in one implementation.  It isn't
that horrible. Hashes are supposed to be fast.  The idea is that you
keep a list of the packages that you have looked at so far.  For
each candidate symbol, you look it up in all the hash tables you have
already used.  If it is found, then you forget that symbol.  If you
search the packages in the right order, this should do the right thing.
The cost of this depends upon how expensive the contents of the loop
are.  It is going to perform N/2 hash lookups per symbol, where N is
the length of the use list.  I conjecture that this will be on the
order of 3.  3 hash lookups isn't that much.  But I certainly won't
do it unless I am told to.  I can think of uses of both possible
semantics.  If you remove duplicates, it is useful for things like
APROPOS.  If you don't, it is useful for code that manipulates the
package system.  E.g. you might use it to look for duplicates,
shadowed symbols, etc.  So it is important to make sure we know
which thing is to be done.  Don't say something like: well, we should
really only show him the symbol once, but some implementations may
not want to go to that work, so it's OK to ignore the problem.
-------