Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: typo in the Go Spec #22495

Closed
balkamm opened this issue Oct 30, 2017 · 6 comments
Closed

spec: typo in the Go Spec #22495

balkamm opened this issue Oct 30, 2017 · 6 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge

Comments

@balkamm
Copy link

balkamm commented Oct 30, 2017

There appears to be a typo in the go spec under https://golang.org/ref/spec#Type_identity. Where it says "These types are identical" it lists:

B0, B0, and C0

Which should probably be:

B0, B1, and C0

Since later it says:

B0 and B1 are different because they are new types created by distinct type definitions; ...

@dsnet
Copy link
Member

dsnet commented Oct 30, 2017

\cc @mdempsky @griesemer

@dsnet dsnet added the Documentation Issues describing a change to documentation. label Oct 30, 2017
@dsnet dsnet changed the title Typo in the Go Spec spec: typo in the Go Spec Oct 30, 2017
@griesemer
Copy link
Contributor

If B0 and B1 are different as it says later, it would be wrong to say B0, B1 and C0 are identical, wouldn't it? This is correct as stated, and on purpose. See also: #22202 and #9226.

@balkamm
Copy link
Author

balkamm commented Oct 30, 2017

Sorry, I guess I misstated it slightly. At the very least, B0 shouldn't be listed twice.

@griesemer
Copy link
Contributor

That's the whole point: Who says that B0 and B0 are identical types? It needs to be spelled out. The types system is a formal system and it's up to the spec to state the rules. It's not as obvious as it may seem: For instance, for a floating-point value x, it's not a given that x == x (it's not true if x is NaN). Or, more closely related: We cannot write nil == nil. And so forth.

But given the number of bug reports this gets it looks like the point is not coming across, or perhaps it too academic.

@balkamm
Copy link
Author

balkamm commented Oct 30, 2017

Okay, thanks for the explanation. Sorry for the confusion.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/87417 mentions this issue: spec: remove example explaining that type B0 and B0 are identical

gopherbot pushed a commit that referenced this issue Jan 11, 2018
Every few months we get a new error report claiming that there
is a typo in the spec related to this specific example. Clearly,
the fact that two types with the same identifier are identical
seems exceedingly obvious to readers; thus the example seems not
worth the trouble. Removing it.

For #9226.
For #22202.
For #22495.
For #23096.
For #23409.

There may be more.

Change-Id: I003ba79dc460ffb028a4ecb5f29efd60f2551912
Reviewed-on: https://go-review.googlesource.com/87417
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@golang golang locked and limited conversation to collaborators Jan 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants