Re: Understanding CLOS Encapsulation



Hi Waldo, exporting a class name only exports the symbol. that means
if you have a class and a function and a variable of that same name in
the package they are all effectively exported. On the flip side of
this, exporting a class name does not automatically export the accessor
names, nor the slot names, nor its sub and superclass names.

If you want to be able to access the slot names from a different
package you should probably export the slot names as well--same for the
accessor functions.

This is annoyance sometimes but can also be a useful feature in that a
class may have slots from different packages. Those different packages
do not have to worry about colliding with slot names from other
packages.

If package PACKAGE-A defines CLASS-A which has SLOT-X, and PACKAGE-B
defines CLASS-B which also has SLOT-X, then in PACKAGE-C you define a
CLASS-C which mixes in CLASS-A and CLASS-B; then CLASS-C has slots
PACKAGE-A::SLOT-X and also PACKAGE-B::SLOT-X.

it is not clear which one you would want to simply refer to as SLOT-X

-jim

.



Relevant Pages

  • More Multiple Classes per File (was Pretty Format...)
    ... Uri Guttman wrote: ... setups to exercise the limits of these paradigms. ... I think key to all of this is that packages that contain subs intended ... exporting no symbols with EXPORTER. ...
    (comp.lang.perl.misc)
  • Re: Image versus package savers?
    ... exporting then backing up your packages frequently, ... Things that I consider risky include: newly changed external interfacing; failure of an MVP triad to open correctly; note that you should never save an image if the dreaded prim g2 garbage collector walkback appears. ...
    (comp.lang.smalltalk.dolphin)
  • Re: Help with packages
    ... to use from outside the package implementation fileneeds to be ... Exporting applies only to SYMBOLs. ... symbol FOO means that both ... Packages in lisp are only there to prevent accidental namespace ...
    (comp.lang.lisp)
  • Re: Read Macro Characters and Packages
    ... I don't have the impression that changing the read table occurs so often that ... My guess would be that exporting ... wondered if perhaps the import itself was considered explicit enough. ...
    (comp.lang.lisp)