This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Trouble understanding define (!)
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> I really want to use simple (descriptive!) name such as `size' and
> `length'. But the accessors create a lot of name collisions. If we
> can find a solution to this problem, I will stop to complain! :)
Let's take the case of the number of entries in an <adress-book> and a
<phone-list>.
In one of my modules, I'm using both, so if I use the natural accessor
name `n-entries', I get a collision. (The two container objects may
of course share a common base class, in which case the problem is
solved.)
Now you may suggest that the way to avoid name collision is to use
more "descriptive" names address-book:n-entries and
phone-list:n-entries.
The problem I have with this is that I have probably already chosen
the name of the variable representing the <address-book> to indicate
its contents, e.g., `address-book'. So, the expression
(address-book:n-entries address-book)
will be redundant: both the first and the second element says that
we're dealing with an address-book.
I want to write
(n-entries address-book)
and
(n-entries phone-list)