Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.clos Subject: Re: clos and packages Message-ID: <1990Dec11.044210.26810@Think.COM> Date: 11 Dec 90 04:42:10 GMT References: <183@anaxagoras.ils.nwu.edu> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 59 In article <183@anaxagoras.ils.nwu.edu> brand@ils.nwu.edu (Matthew Brand) writes: > Now if I have to have a different name for the method of each > package, that rather defeats the point of using an object system. If the two classes are implementing methods for the same generic function, then they should both reference the same generic function name, not symbols in different packages. > On the other hand, since CLOS doesn't allow me to make functions > private or public, I need to use packages. Whoever wrote the intern > function forgot to check whether or not a symbol references a method; > in that case interning should proceed, provided that the argument > lists are congruent. Hence my question: The identity of symbols in Common Lisp is independent of what they happen to be used to name at any particular time. A symbol may simultaneously name a global variable, a function (either generic or not), a property list, a slot (of both a defstruct and a class), a property on a property list, an entry in an alist, an entry in a hash table, etc. > > (use-package 'spline-package) > T > > (use-package 'fractal-package) > >>Error: If the USER package were to 'use' the FRACTAL-PACKAGE package, > there would be name conflicts with symbols found in the > following packages ("SPLINE-PACKAGE" "FRACTAL-PACKAGE") > The particular symbols involved are: > (SHOW) You complain above about INTERN, but your example uses EXPORT and USE-PACKAGE, which are completely different. Symbols have identity independent of their names; they are first-class Lisp objects, and other objects have references to them. However, a package can only have one symbol with a particular name. The entry for "SHOW" in the using package can either be refer to SPLINE-PACKAGE:SHOW or FRACTAL-PACKAGE:SHOW, but it can't refer to both. You can't just get rid of one of them, because there are all these references to them. > Does anybody have a fix for this? Create a new package, e.g. GEOMETRY-PACKAGE, which will be used for symbols common to splines, fractals, etc. Export these symbols from GEOMETRY-PACKAGE, and have SPLINE-PACKAGE and FRACTAL-PACKAGE do (use-package 'geometry-package). > Also, does this only happen in Lucid CommonLisp with PCL? It's normal Common Lisp. Symbols are just symbols. There was a discussion in comp.lang.lisp a couple of months ago about whether packages are appropriate for emulating the public/private mechanisms of some other object systems, and whether one package per class is reasonable. The concensus is that the package system was designed for a small number of large groups, not lots of tiny packages. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar