quote:
Original post by Flarelocke
This is a good thing.
Not all the time. When you're creating an ADT, for instance, you obviously need to know all about the type you are creating, and that includes specialising methods for that type. Python's single despatch model is simply a special-case of despatching off of the "self" parameter. CLOS's multimethods provide a generic despatch model, allowing you to despatch off any number of formal parameter types, but you need declarations to be able to specify which types are involved. It is often a good thing that you don't know the exact type at the callsite, which is the point of polymorphism, but you can't make a blanket statement that we should never know the type.
quote:
But the codification of the idea that a type is anything more than a bunch of operations that can apply to some object, some of which you may need, some you may not, is definately not a feature I want in any language I program.
Yes, I agree. I've been quite clear elsewhere that I do not like languages that force you to make explicit declarations all over the place, as it's extraneous nonsense.
quote:
It is more likely that I would argue that overloading is never a more useful construct than overloading based on runtime type determination.
In software design, you should try to keep away from words like "never" and "always". If we're forced to maintain a type-switch rather than have the compiler do the work, then that's clearly irrelevant nonsense. It also breaks down your argument that we should never know the type we are dealing with. Being able to switch on type this way allows the callsite to employ the most appropriate syntactic form for the problem. For example, something I sometimes want to do is pass a list or tuple to a function, and have it perform an action for each element. If there is only one element within that list, I like to offer the syntactic pleasantry of doing away with the formation of a single-element list, and to do that I have to perform a type-switch to avoid Python throwing a TypeError - the iteration construct demands an iterable type, while the language does not allow us to build our own constructs which also demand certain types [1]. That puts the programmer in a subordinate position to the language designer even for their own problem domain, even though the programmer is the one who knows what their problem demands.
quote:
This is a philosophical difference
It has hard tangible results which can be seen in the number of lines of code required to solve a problem that would benefit from the presence of single dynamic despatch. From the Lisp POV that you're arguing elsewhere, this would not be such a problem if you could provide your own mechanism and have it fit into the language. Languages which disallow access to the intermediate representation by providing an obfuscating layer of enforced syntax do not allow modification or enhancement of that enforced syntax. But that's an entirely different argument that I don't wish to pursue in this thread - it's already been discussed in the numerous Lisp threads.
quote:
Lisp's most interesting contribution is the aggregation of pretty much all features of a programming language into one construct (the function).
The above comment is nothing more than your personal opinion. It's not relevant to the issue of overloading and/or generic despatch in Python.
quote:
One would think, then, that a lisper would sympathize with the point of view of maximizing the orthogonality of language features.
You can't just cook up some imaginary stereotype and tell me my view isn't consistent with it. Concentrate on what's been said please, not on what might or might not be the opinion of a group of people you've never met. Declarations and generic despatch exist and are used in CL, which is all we need to know.
quote:
Of course, if you're talking about increasing the complexity by increasing the number of predefined functions or modules
I'd expect you to understand by now that is not what I'm talking about.
Edit:
[1] Or it may be sufficient to have bounded parametric polymorphism, where we don't have to explicitly mention the type, but we need to say what properties the type must have. For my example, we might say that the type must be iterable.
[edited by - SabreMan on March 18, 2003 6:17:41 AM]