News for hackers. Stuff that matters.
Re:Ruby 3.4.0 by codesnik on Wednesday December 25, 2024 @08:18AM (#42508650)
...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.
Re:Ruby 3.4.0 by psychoslave on Wednesday December 25, 2024 @10:58AM (#42509373)
Sure, 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.
Re:Ruby 3.4.0 by mdaniel on Thursday December 26, 2024 @03:12PM (#42517432)
There 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> Crazypants.
Re:Ruby 3.4.0 by codesnik on Thursday December 26, 2024 @09:41PM (#42519528)
yeah, you can combine it with % formatting operator to do stuff like `% %% % %%%`