DO-SYMBOLS-DUPLICATESDO-SYMBOLS executes the body once for each symbol accessible in the package. It does not say whether it is permissible for the body to be executed more than once for some accessible symbols. The term "accessible" is defined on page 172 to include symbols inherited from other packages (not including any symbols that may be shadowed). It is very expensive in some implementations to eliminate duplications that occur because the same symbol is inherited from multiple packages.DO-SYMBOLS a note that it may execute the body more than once for some symbols.(SETQ A (MAKE-PACKAGE 'A)) (SETQ B (MAKE-PACKAGE 'B)) (EXPORT (INTERN "ASYM" A) A) (USE-PACKAGE A B) (EXPORT 'B::ASYM B) (USE-PACKAGE B A) (DO-SYMBOLS (X B) (PRINT X)) ;; this may print ASYM once or twice.
DO-PACKAGE would not be harmed by the presence of duplicates. For these applications it is unreasonable to force users to pay the high cost of filtering out the duplications. Users who really want the duplicates to be removed can add additional code to do this job.DO-SYMBOLS eliminates duplications will have to be modified. (Such code was not truly portable.)
The need for DO-SYMBOLS to be efficient is questionable, however; for many applications (e.g., global package manipulation), duplicate values would create havoc.
For some implementations, the performance penalty would be well over a factor of two.
Several proposals were considered for adding keyword arguments to DO-SYMBOLS which might specify :ALLOW-DUPLICATES, adding keywords and eliminating DO-EXTERNAL-SYMBOLS, etc., but no clear consensus was reached for making additions.
This version is the closest to the status quo.