Re: Generics vs. Message passing: object namespaces
Pascal Costanza <[email protected]> Fri, 23 Feb 2007 10:49:02 +0100
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On 23 Feb 2007, at 01:47, Randall Randall wrote: > On Feb 22, 2007, at 7:17 PM, Pascal Costanza wrote: >> On 23 Feb 2007, at 00:14, Tom Locke wrote: >> >>>> With a good module / package / type system, you can say (append >>>> buffer x) when it's unambiguous what you mean, and >>>> (buffer:append buffer x) when it's not. >>> >>> Does "good" mean better than anything we currently have in a >>> production-grade language? >>> >>> CLOS and Dylan do in fact suffer from type-name-in-the-method- >>> name syndrome do they not? >> >> The simplest answer I can think of is this: Generic functions are >> just functions, so any approach that solves namespace management >> issues well for function names is automatically also good enough >> for generic function names. > > But these should accomplish different things. Regular functions > need to be kept separate, but generic functions need to be folded > into the same name in the namespace you're using them in, unless > there's some specific reason the programmer doesn't want to do that. I don't quite follow you. The only difference between functions and generic functions is that functions are defined in a single place whereas generic functions can have distributed definitions. This means that you need access to some namespace when you want to call a function from that namespace - and this is the same for functions and generic functions. Additionally, you may need access to some namespace when you want to define methods on a generic function from that namespace. But that's the only difference here. It may be important to stress that methods are essentially anonymous. Only the generic functions that contain them have names. (In a Scheme- style language, even the generic functions are anonymous and are simply bound to variables, so in such languages this all boils down to having a good modularization mechanism for plain variables.) Pascal -- Pascal Costanza, mailto:[email protected], http://p-cos.net Vrije Universiteit Brussel, Programming Technology Lab Pleinlaan 2, B-1050 Brussel, Belgium -- Pascal Costanza, mailto:[email protected], http://p-cos.net Vrije Universiteit Brussel, Programming Technology Lab Pleinlaan 2, B-1050 Brussel, Belgium