From an intense disagreement this afternoon:
func foo<T: protocol<A,B>>(x: T)
vs
func foo<T: protocol<A, B>>(x: T)
Clearly the latter wins. But why? Because orthography matters.
Strunk writes, “omit needless words”. But Strunk did not write, “omit needless keystrokes”. Space-delimited commas offer semantic and syntactic separation between two related items. It follows the convention commonly used in mathematics.
A space-delimited comma supports natural language precedent allowing the eye to scan each token as a distinct entity. It serves as a pause signal for the code reader, allowing mental differentiation between the two elements (in this case, dual protocols).
Without that pause, the two protocols blend into an undifferentiated mass, especially as they are surrounded by the angle brackets used to construct the protocol conformance and type parameter. Allowing space to breathe creates a more readable product, and is to be preferred to its spaceless alternative[1].
[1] This advantage is to be conveyed to all users, whether or not they are Canadian in origin.
2 Comments
Imagine if The Lord of the Rings had been written without punctuation. How long would the average reader last before throwing the book away in frustration? Harry Potter without paragraphs? Game of Thrones without space characters between each word? Or even worse, what about a book that occasionally had punctuation, but not always?
I don’t even understand how that conversation could have been heated. Space matters, consistency matters. And I’m not even Canadian.
We Germans strongly support the space delimited comma. It makes code much more readable. And we are not even Canadians. 😉