
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Op 14-mei-2008, om 15:43 heeft Patrick Surry het volgende geschreven:
It would be nice to be able to use a richer set of symbols in your source code for operators and functions (e.g. integral, sum, dot and cross-product, …), as well as variables (the standard upper and lower-case greek for example, along with things like super- and sub-scripting, bold/italic and what-not). You could imagine ending up with source code that reads just like a mathematical paper.
People have already thought about this, and it partly works already in GHC. See http://hackage.haskell.org/trac/haskell-prime/wiki/ UnicodeInHaskellSource. I don't like, however, the tendency of many Haskell authors to use math-like variable names. There are far to many Haskell programs where you rarely find a variable name of more than three letters, and all those variables that have more than one letter are English names for Greek letters like 'phi' or 'mu'. It makes a difference for your style whether you are just talking to humans (a math paper) or to humans and compilers at the same time (a computer program). When talking to a compiler, the compiler is not interested in the semantical explanations, so programmers mostly leave them out. But when you do that, you must make sure that the formal language is still comprehensible to humans - I'd say by using descriptive variable names. Regards, Reinier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkgrH04ACgkQR3bgBiWODBfrBQCeLVEIiYDbXdCFJbTI4HZkJr7e qysAn2M3XDynT/NAINsVaeH23XVre1Kf =Zv7j -----END PGP SIGNATURE-----