[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CLX draft 3 revisions
From: Dan Carnese <CARNESE@SPAR-20.ARPA>
Subject: Re: CLX draft 3 revisions
A basic problem with function names that include class names,
such as font-height, is that it is bad for extensibility. When
subclasses of the existing class are defined, e.g., adobe-font,
users of those subclasses will have to remember which ancestor
class must be used to construct the name of the function. This
makes such systems more difficult to learn and increases the
incidence of trivial but annoying programming errors.
Don't think of names like window-height as including the name of a
class. You should think of these as including the name of a protocol
(eg the window protocol).
Notice that the :accessor-prefix option in CLOS has no default value.
In particular, it doesn't default to the name of the class followed by a
"-". This was done to explictly avoid any automatic mapping from
class-names to accessor-prefix.
As for packages, they may sometimes be helpful for this problem. But as
I said in my earlier message, it depends on lots of things, like the
size of the module. For example, one could imagine a graphics package
which had lots of different kinds of windows and lots of different kinds
of graphics objects. Within the GRAPHICS package, it might be
appropriate to have 2 generic functions, window-height for all kinds of
windows and graphics-object-height for all kinds of graphics objects.