An awkward, complex sentence in the Go spec

187 views
Skip to first unread message

Ben Hoyt

unread,
Apr 13, 2018, 9:38:56 AM4/13/18
to golang-dev
This sentence in the Go spec under https://golang.org/ref/spec#Constant_expressions took me several attempts to parse:

"Except for shift operations, if the operands of a binary operation are different kinds of untyped constants, the operation and, for non-boolean operations, the result use the kind that appears later in this list: integer, rune, floating-point, complex."

It was the two comma'd clauses "the operation and, for non-boolean operations" in the middle that caused me to do a double and triple-take. Partly because there are so many clauses piled up, but partly because I first read "the operation and" as "the operation &".

Seems like this sentence could be refactored for simplicity. I think setting off "for non-boolean operations" in parens instead of commas would help a little. Or, probably better, breaking up into a couple of sentences. There are three types of operations here with different behavior: shift operations, boolean operations, and normal/other operations.

-Ben

Bryan Mills

unread,
Apr 13, 2018, 11:57:07 AM4/13/18
to golang-dev
I find it kind of difficult to parse too. I'll send a change.

Bryan C. Mills

unread,
Apr 13, 2018, 12:05:04 PM4/13/18
to golang-dev

peterGo

unread,
Apr 13, 2018, 12:23:57 PM4/13/18
to golang-dev
Bryan,

What is the open issue for this change?

https://github.com/golang/go/issues

Peter

Bryan Mills

unread,
Apr 13, 2018, 1:01:53 PM4/13/18
to golang-dev
There isn't an issue filed: the change is a minor clarification without any semantic effect.
Reply all
Reply to author
Forward
0 new messages