Re: Symbol clashes: how to avoid them. Part 2



budden wrote:
Hi Group!

This topic originates from the following discussion:

http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/00e2aa56a0f84b20/feaa03484c1c653a?lnk=raot#feaa03484c1c653a

But in the course of that discussion I suggested an obviously
incorrect solution to that problem, so I dare to restart discussion
from the scratch.

Problem is the following:

This reads like typical introductions to promoting solutions for non-issues. ("Untyped programs may give runtime type errors.", "Traditional macro systems may break hygiene.", etc.)

How often does this problem really arise?

I don't have that problem.

(defpackage :p1 (:exports :sym :sym1))
(defpackage :p2 (:exports :sym :sym2))
(defpackage :p3 (:use :cl :p1 :p2)) ; error: sym is ambigious.

Sometimes there are many symbols in p1 and p2, we intend use some of
them, but never going to use :sym. Even if we are going to use that,
we agree to qualify it with it's package name. But we want to refer
all non-clashing symbols by their direct names, w/o package prefix.
We'd wanted to just use both p1 and p2. Lisp still allows us to do
that, but we need to write something like:

(defpackage :p3 (:use :cl)
(:import-from :p1 . list-of-all-external-symbols-from-p1-but-sym)
(:import-from :p2 . list-of-all-external-symbols-from-p2-but-
sym))

(defpackage :p3 (:use :cl :p1 :p2)
(:shadow :sym))

?!?



Pascal

--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.