Re: with-slots usage question
"Robert P. Goldman" <[email protected]> Mon, 10 Nov 2003 18:57:40 -0600
| Newsgroups | gmane.lisp.clump |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Nikodemus" == Nikodemus Siivola <[email protected]> writes: Nikodemus> On Mon, Nov 10, 2003 at 02:15:37PM -0600, Robert P. Goldman wrote: >> I feel awfully stupid asking this, but.... Can't you just shadow >> LENGTH and STRING in your package if you want to override them? Nikodemus> "Yes, but I don't want to." >> So I can make a generic function for LENGTH that has as its default >> method (for type T) COMMON-LISP:LENGTH, and put whatever other methods >> I want for it. Yes? Nikodemus> This I had not actually thought of. Nikodemus> I like the idea in essence, but have the feeling that Nikodemus> this is asking for trouble. Nikodemus> In the very least, STRING is also a type specifier, so Nikodemus> the amount of hair is greater then just shadow + Nikodemus> defgeneric. (Applies to VECTOR, ARRAY, etc. as well.) Yes, that's why I said I liked the idea of interfaces instead of packages. I think there's been a good big rant about packages that said about all there was to be said, by Richard O'Keefe, in the context of prolog. However, I think we're stuck with them. There's locales, of course, but I'd rather have something my compiler groks. Nikodemus> Fortune favors the bold, though, so I've adopted this Nikodemus> in Linedit in spirit of experimentation. Upsides of Nikodemus> tiny codebase and utterly non-critical application. ;) I've actually done this in the context of a small module in a very large running system, and it worked ok. But I didn't shadow any of the function names that were also datatypes... I suppose one could do something weird where one shadowed a symbol, to cover up its function definition, and then used some heinous setting to get the variable interpretation. It occurs to me that I don't know how the typing stuff is associated with symbols. I'll take a look tonight when time permits... Cheers, R