4 ms·
As I implied, I find the Haskell-like languages attractive. To the point that I am taking that approach in a toy language. But you are right, the cost of it is
by dunham 4y ago
As I implied, I find the Haskell-like languages attractive. To the point that I am taking that approach in a toy language.
But you are right, the cost of it is pretty high - not just copy/paste, but it's tricky to parse, auto-formatting is harder, LSP support (changing code) is harder, renaming variables and functions is harder, etc. (Haskell-like languages are worse than Python because they don't always start a new indentation level on a new line, so renaming can change the indentation level.) So it's probably not worth it.
And I will add, like the sibling commenter, I like the auto-format on save of Go. When writing Go, I'll type whatever, often on one line, and let the formatter take care of making it pretty.
- dorfsmay 4y agoIt's not just golang, it's your tooling assuming the syntax of the language you use allows it. I do "reformat on a hot key" in both Rust and Typescript, and use it constantly, way before I save, it helps me review and confirm my logic makes sense. The other advantage is that it standardizes formatting for a given repo making diffs more relevant. Ironically, I believe Python PEP 8 is what started and normalised the idea of taking formating decisions away from developers.