3 ms·
...but ruby is whitespace sensitive too. It's hard to notice, because rules mostly follow intuition, but there're cases when not only a missing newline, but abs
by codesnik 2y ago
...but ruby is whitespace sensitive too. It's hard to notice, because rules mostly follow intuition, but there're cases when not only a missing newline, but absense or addition of a space changes resulting syntax. Currently I remember only difference in parsing unary vs binary operators, like + and *, and ternary operator ? : vs : in symbols, but there're certainly more other cases.
- psychoslave 2y agoSure, like `a ?b :c` is nothing like `a ? b : c` (I guess the former is actually invalid), but that's obviously not what the previous message was referring to when speaking of Python which uses spaces as main facility to determine block scope.
- mdaniel 2y agoThere was a recent thread about parsing Ruby wherein I learned that the % quoting character accepts any character following it as the opening/closing delimiter <https://news.ycombinator.com/item?id=42032212 https://news.ycombinator.com/item?id=42032212> Crazypants.
- codesnik 2y agoyeah, you can combine it with % formatting operator to do stuff like `% %% % %%%`