[Haskell-cafe] Why shouldn't variable names be capitalized?

Lennart Augustsson lennart at augustsson.net
Fri Aug 4 23:19:08 EDT 2006


There are two places where confusion could arise if you didn't have  
the case distinction in Haskell: pattern matching (does a name refer  
to a constructor or not) and type expressions (is it a type variable  
or not).

In Haskell the distinction is made by case, but this is far from the  
only choice.  There are other ways to mark what is a variable and  
what is not.  I don't necessarily think that Haskell did it the best  
way, but then this is a minor syntactic issue.  Changing the case of  
variables is a pretty low price to pay to solve this problem.

	-- Lennart


On Aug 4, 2006, at 13:12 , Martin Percossi wrote:

> Hi, I'm wondering what the rationale was for not allowing  
> capitalized variable names (and uncapitalized type names and  
> constructors). I can only think of two arguments, and IMHO both of  
> them are bad:
>
> 1. Enforces a naming convention. Fine - but my view is that this  
> doesn't belong in the language definition (it belongs in the user's  
> coding standards). I get annoyed, for example, that when I write  
> code that manipulates matrices and vectors, I can't refer to the  
> matrices with capital letters as is common in the literature. And  
> to anyone who says that it's good to enforce naming consistency, I  
> have this to say: Any language that requires me to learn about  
> category theory in order to write imperative code should treat me  
> like an adult when it comes to the naming of variables as well. ;-)
>
> 2. It makes it easier to write the compiler. I don't think I need  
> to explain why this is bad...
>
> I imagine that someone is just itching to "sort me out". Do your  
> worst! ;-)
>
> Thx
> Martin
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list