Chances are the program you're using to write your e-mails was written in C++ (or at least C), so don't knock it. :-)

In any case, no one has really addressed the original poster's question: No, "name overloading" is not possible in Haskell, and surprisingly, there are no blocking technical issues why this must be the case.

As a result of this limitation, we end up with abuse of type classes and endless synonyms, suffixes, and postfixes, and funky operators whose meanings must be inferred from documentation rather than convention.

Name overloading can certainly be abused, but in my opinion, the lack of it results in more problems than it eliminates.

Regards,

John A. De Goes
N-BRAIN, Inc.
The Evolution of Collaboration

http://www.n-brain.net    |    877-376-2724 x 101

On Feb 13, 2009, at 3:43 AM, Neil Mitchell wrote:

Hi

Table is a table of name-value pairs I want to substitute in a tree- like
structure using:

substitute :: Table -> Tree -> Tree

For substituting a single name-value pair I want to define this utitlity routine so I don't have to construct a Table all the time in the user code:

substitute :: String -> Value -> Tree -> Tree

Why not:

substituteValue :: String -> Value -> Tree -> Tree
substituteValue x y = substitute (table1 x y)

In the case I believe it would certainly be good to be able to name both functions the same, but I fear I can not do so? There are languages where this is explicitelly allowed (e.g. C++ or Java), so I don't think it is such
an unuseful or evil thing.

Languages like C++ and Java allow mutable state, object-orientated
programming and require massively verbose code - all of which are
unuseful and evil :-)

I think this is a case of trying to apply C++/Java thoughts on to
Haskell, you can map the concepts directly, but you really shouldn't.
Try writing multiple methods with many names, or simple utility
functions to convert between the cases, and it will go much nicer.

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to