Re: with-slots usage question
Daniel Barlow <[email protected]> Tue, 11 Nov 2003 17:01:26 +0000
| Newsgroups | gmane.lisp.clump |
|---|---|
| Message-ID | <[email protected]> |
[after rearranging all my mail folders at the weekend, I find that gnus is automatically filtering clump into its own group: smart, but not telling me the group exists: not smart. So, I'm catching up] Miles Egan <[email protected]> writes: > I guess the ideal thing here from the programmer's point of view would > be a language in which all functions are generic and the implementation > is smart enough to optimize the ones that are never used > polymorphically. Not really. The methods of a GF must have congruent lambda lists - though it's pretty likely that your LENGTH method takes a single argument and therefore doesn't conflict with the builtin (LENGTH SEQUENCE), you still run into drouble when you want to define (OPEN DOOR) I believe that the style to aim for, if you're going to get hung up on style, is that a generic function does conceptually the same thing whatever objects you call it on, but may do it in different ways for different objects. So, it's OK to have an AREA gf that works on polygons, but extending it to work on secret military bases (it returns `51' for bases in the Nevada desert) is wrong, because that's not the same thing. So I tend to try to make GF names reflect the general class of object they apply to: POLYGON-AREA is an identifiable concept whether or not there's a class called POLYGON. Whether the methods of the GF are implemented as accessors is a side issue. (Is the height of a triangle "the same thing" as the height of a rectangle? The latter is the length of one of its sides, which doesn't necessarily hold for the former. Depends on the application. Discuss. All the time I save when programming from Lisp's interactive development style and prototyping, I lose again agonising over this stuff I wouldn't have time to worry about if I just used Java) -dan -- http://web.metacircles.com/cirCLe_CD - Free Software Lisp/Linux distro _______________________________________________ Clump mailing list [email protected] http://manly.caddr.com/mailman/listinfo/clump
signature.asc
(application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/sRXsHDK5ZnWQiRMRAuyXAJ0dLcVPYamZl1LHtA2jO2yECaSW4QCgtzL1 z3PVSmCH32tuLRGHKiJxF24= =zqK1 -----END PGP SIGNATURE-----