3 ms·
That’s preciseLy my point. This looks nice, but it’s too easy to forget tone of those spaces and to hard to spot that.
by Someone 5y ago
That’s preciseLy my point. This looks nice, but it’s too easy to forget tone of those spaces and to hard to spot that.
- kazinator 5y agoI don't know of a good design that won't lead you to make errors when you don't want the spaces. You'd need some piece of syntax which indicates whether you want a space there or not. For instance, there could be a rule that a string literal ending in non-whitespace cannot joined with a literal starting with non-whitespace: "foo" "bar" // error "foo " "bar" // OK "foo" " bar" // OK "foo" "" "bar" // OK: "" doesn't start with non-whitespace, since it's empty "foo" " " "bar" // OK The nice thing about this is that it's perfectly comatible with existing C. All we have to do is to implement a compiler warning which detects when the rule is violated. Users who implement it have to fix situations like "foo" "bar" into "foo" "" "bar". Probably the rules should be smarter. Some kind of tokenization concept could be at play so that gluing together two letters or digits is bad, or two punctuation tokens, but letter/number and punctuation is okay. "foo" "1" // error? OK? "foo" "bar" // error "foo" ".bar" // OK "1." "2" ".3" // OK "1." ".2" // error: punct-punct