don't use allnames() in declsset().

Instead of building a dictionary of all visible names, ascend the block chain,
checking for duplicates at each level.
use blockchain generator instead of explicit loops.