>Perhaps a "better" solution than ad hoc polymorphism would be to provide
>a more convenient namespace syntax. Am I mistaken in thinking that
>overloading, for overloading's sake, isn't what is wanted; what is
>wanted is to be able to easily differentiate between two functions that
>happen to be named the same? Ad hoc polymorphism is probably the most
>"convenient" differentiation mechanism, but is it the "best"?

Personally, I don't think ad hoc polymorphism outside of the class system sits well 
with Haskell, or the "spirit" of Haskell.

In this particular example, I think Michael's analysis is correct---one only wants to 
differentiate between the prelude "product" and the product defined in some module.  
If you agree to use the identifiers defined in that module only in a qualified way, 
then the only difficulty is in differentiating between the two products _within_ that 
module.  And that can be done by either hiding the prelude version, or changing the 
identifier to, say, "myProduct", and introducing a mechanism for renaming on export.

Using this example as an argument for ad hoc polymorphism is like using a breach of 
table manners at a summit meeting as an excuse for all-out nuclear attack.

--FC

Reply via email to