4 ms·
Hi. I'm sorry that seemed impatient, dismissive, and (as you say in one of the replies) passive aggressive. I certainly didn't intend it that way. As gohrt and
by rsc 11y ago
Hi. I'm sorry that seemed impatient, dismissive, and (as you say in one of the replies) passive aggressive. I certainly didn't intend it that way. As gohrt and carussell noted, the point was that if you write ~ in a Go program (perhaps because you don't realize Go is different from C here), the Go compiler goes out of its way to explain.
Compiling
package main
func main() {
println(~5)
}
produces
main.go:4: the bitwise complement operator is ^
(http://play.golang.org/p/dFoaHVNOJw http://play.golang.org/p/dFoaHVNOJw).
I am not sure why my 2010 email didn't include a direct link to the Go program on play.golang.org. I suspect that play.golang.org didn't yet support "sharing" at the time, but I don't remember.
I believe the point of the link to the spec was to make clear that the compiler implementation is not the only source for answers, that the operator is also documented.
Thanks for pointing this out. Both parts of the response were intended in the spirit of "let me show you how" and not "go figure it out yourself". I will try to make that clearer next time.
- kylequest 11y agoNo need to be sorry :) Personally I'm fine with those types of responses because I'm more interested in the information and not its presentation. However, with that specific question a great answer would also include "why" (why Go uses a different operator there). The intent ("let me show you how") is definitely good, but it was lost in delivery. It turned out to be like a joke without a setup. Without the missing context it just looks like a non-answer to a simple question.