Re: Understanding CLOS Encapsulation
- From: "Jimka" <jimka@xxxxxxxxx>
- Date: 7 Jan 2006 04:01:31 -0800
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
.
- References:
- Understanding CLOS Encapsulation
- From: Waldo
- Understanding CLOS Encapsulation
- Prev by Date: Re: Newbie question about quote
- Next by Date: Re: package system .. severely broken?
- Previous by thread: Re: Understanding CLOS Encapsulation
- Next by thread: Re: Understanding CLOS Encapsulation
- Index(es):
Relevant Pages
|