4 ms·
There's pros and cons, you've highlighted the pros of removing delimiters. Some cons... 1. Cutting and pasting code means we have to manually re-indent every l
by vorg 14y ago
There's pros and cons, you've highlighted the pros of removing delimiters. Some cons...
1. Cutting and pasting code means we have to manually re-indent every line when it's required. We can't just let a formatter do it.
2. Tabs in the code has better be prohibited by the lexer.
I actually think there's room for a language which allows either all delimiters OR all indentation OR anything in between. An IDE can easily convert code written in one style into the other. Haskell is a good experiment in this.
- vog 14y agoI fully agree with "2.", as tabs in source code are a pain. However, I don't see what this has to do with the discussion about removing delimiters. Could you elaborate on that? Regarding "1.", I have yet to find a really good formatter that works well in all edge cases. But pretending there is one, re-indenting copy&pasted Python code is just a matter of selecting it and pressing a few times ">" or "<" until the code is at the correct indentation level. (Replace ">"/"<" with "tab"/"shift+tab" or whatever keystroke your editor provides for adding/removing indentation.) There's absolutely no need to carefully re-indent it line by line, and it's almost as fast as running the formatter. I agree that the ML languages (Haskell, Ocaml, etc) have a quite liberating approach to delimiters. You need the delimiters almost never, yet the code is unambiguous even without relying on indentation. It would be great to see some good comparisons between Haskell and Python regarding their approach to (almost) eliminating the need for delimiters.