3 ms·
> How do I know it is over? In an indentation sensitive syntax, you simply look at the next line and see if it has more or less or equal indentation. Then you'
by dwheeler 9y ago
> How do I know it is over?
In an indentation sensitive syntax, you simply look at the next line and see if it has more or less or equal indentation. Then you're done. That turns out to be extremely fast, because the eye/brain combination is exceedingly good at determining if something is left or right or something else.
In traditional s expressions, to match things up you have to count the parentheses, which the brain is extremely bad at. In practice, the brain is so bad at this that we have to depend on complicated tooling to do the formatting for us. In a typical editor, that means that we depend on things like left-right distance anyway. Since people depend on indentation in the first place, making it syntactically relevant simply applies what people already do to the syntax itself.
- taeric 9y agoYou somewhat skip my point. You agree that you know it was over by parsing the structure. Which you have to do in both cases. In one, though, the parser rules are more than, scan for last paren. Gets more complicated once you have stuff like the <* symbols resetting indentation and blank line rules. Or the $. Not to say it can't be done. But I could easily argue the brain is bad at juggling rules. The more rules, the more likely mistakes. Since I am typically building rules in the logic, having extra rules in parsing seems to require more of where I will likely make mistakes. To be clear, I am presenting my preference. I am not trying to claim superiority.
- dwheeler 9y ago> But I could easily argue the brain is bad at juggling rules. The more rules, the more likely mistakes. The brain isn't great at LEARNING rules, but the vast majority of programming languages use more rules than Lisp, and since most people use those other languages instead, it's clearly possible to learn more rules than the ones Lisp provides. Indeed, Lisp's syntax currently insists that you not use infix notation, which means in practice people have to learn a new syntax. Practically every other language (with the exception of Forth) supports infix notation. The "$" has essentially the same meaning as Haskell, so if you know Haskell's rule, you already know it. The "blank line ends the block" is what most people would assume anyway. The <* ... *> ones are unusual, but they don't take long to learn or master, and counter a complaint about indentation ("stuff marches off to the right"). It's hard to argue preferences. Ideally we'd have some scientific studies really examine these kinds of issues! Sadly, those kinds of studies are in short supply. Thanks for the commentary.