4 ms·
This article makes a strong case for every language to use ‘;’ as a statement separator.
by librasteve 7mo ago
This article makes a strong case for every language to use ‘;’ as a statement separator.
- jasperry 7mo agoIndeed it does, by showing how many different and confusing types of parsing rules are used in languages that don't have statement terminators. Needing a parser clever enough to interpret essentially a 2-d code format seems like unnecessary complexity to me, because at its core a programming language is supposed to be a formal, unambiguous notation. Not that I'm against readability; I think having an unambiguous terminating mark makes it easier for humans to read as well. If you want to make a compiler smart enough to help by reading the indentation, that's fine, but don't require it as part of the notation. Non-statement-based (functional) languages can be excepted, but I still think those are harder to read than statement-based languages.
- hajile 7mo agoLisps aren’t necessarily functional, but don’t need semicolons either.
- II2II 7mo agoThe syntax of languages like Lisp and Forth are so fundamentally different that they don't need an explicit statement separator. You don't have to think about many other things either, or I should say you don't have to think about them in the same way. Consider how much simpler the order of operations is in those languages.
- wvenable 7mo agoLisp has explicit "statement" terminators (just aren't semicolons)
- hajile 7mo agoAll the lisps I know of have only expressions (no statements).
- rao-v 7mo agoExactly. I genuinely do not understand how any significant user of python can handle white space delimitation. You cannot copy or paste anything without busywork, your IDE or formatter dare not help you till you resolve the ambiguity. One day https://github.com/mathialo/bython https://github.com/mathialo/bython one day!
- silon42 7mo agolooks cool.. Alternatively, I've several times used 'pass' as block terminator for my personal code.
- xigoi 7mo ago> You cannot copy or paste anything without busywork Sounds like a tool issue. My editor (Neovim with a few plugins) can handle copying/pasting with indentation just fine.
- eviks 7mo ago> your IDE or formatter dare not help you Get the ones that do help you! Problem solved, enjoy your clean reading experience!
- rao-v 7mo agoThe problem is that if you copy random code from the internet it cannot figure out the right indentation level - whitespace has meaning in python. What IDE can automagically handle this?
- eviks 7mo agoDo you mean "figure out that I'm pasting at level 3, so all pasted code should have +3 levels of indents" like plugins like this one do? https://marketplace.visualstudio.com/items?itemName=hyesun.py-paste-indent https://marketplace.visualstudio.com/items?itemName=hyesun.p... (Sublime has the same, so does vim see comment above, so do many real IDEs) Or do you mean something different?