3 ms·
> [M]y experience with Haskell means that I now see potential bugs everywhere in imperative code. [...] Now I know there are other ways of doing these things, I
by dozzie 11y ago
> [M]y experience with Haskell means that I now see potential bugs everywhere in imperative code. [...] Now I know there are other ways of doing these things, I find it difficult to be satisfied with any of the code I write. I am constantly aware that I am writing traps that other people are likely to fall in.
Good. That's exactly what it was supposed to do to your mind. Now you need to
learn to live with this awareness, and you need to learn how to minimize the
amount of traps you leave behind.
> I also find C# code very ugly compared to both Python and Haskell. On the visual level, the mandatory use of braces everywhere [...] makes code contain a lot of line noise and empty space, and combined with the verbosity of the libraries and type declarations etc, you find that a page of C# hardly does anything.
Learn two or three more languages and you'll find that this visual clutter
hardly matters. What's important is how much can you do with the same amount
of statements and expressions (I find Paul Graham's proposition that this is
related to the count of AST nodes appealing).
> 2. Using functional style obfuscates your code when using other languages.
This sounds like the really old programming joke: "good programmer can write
in Fortran in any language".
Some constructs are not a good fit for some languages. I avoid map(),
filter(), and reduce() in Python like the plague, but I find list
comprehensions appropriate. You need to learn to switch between paradigms and
sets of idioms, not to cram the same set everywhere.
- douche 11y ago> > I also find C# code very ugly compared to both Python and Haskell. On the visual level, the mandatory use of braces everywhere [...] makes code contain a lot of line noise and empty space, and combined with the verbosity of the libraries and type declarations etc, you find that a page of C# hardly does anything. > Learn two or three more languages and you'll find that this visual clutter hardly matters. What's important is how much can you do with the same amount of statements and expressions (I find Paul Graham's proposition that this is related to the count of AST nodes appealing). I would agree that if you follow the official Microsoft C# style conventions, you end up with some ugly looking, noisy code. I am not a fan of sticking opening braces on their own line, or forcing a newline between closing braces and else, catch, finally keywords. It is just a waste of too much vertical space, for questionable benefit.