4 ms·
Ok, let me replace my “can’t” with “is a lot less likely to”. I checked: neither // nor /// can be used as operators (syntax error: they both just start a comm
by micampe 12y ago
Ok, let me replace my “can’t” with “is a lot less likely to”.
I checked: neither // nor /// can be used as operators (syntax error: they both just start a comment). All your other examples work, but I would say those mean the author is intentionally trying to trick me. Or he’s writing a clever DSL, but that line is very fine and treacherous.
- Someone 12y agoThanks for the checking. And I agree: that line is thin. Some other food for thought: a = b-- // !z x = y--// ! z The first does a = b - 1 and has a comment, the second calls suffix --// on y, then infix ! On the result and z. A variation: x+ - 3 x + -3 I think it is fair to say that Swift introduces a new variant of whitespace sensitivity. Also, the docs do not seem to discuss line breaks inside statements. If they are legal, you can do: x+ -3 vs x+{space} - 3 I think I would find it fun to stress test this language.