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

type identity. B0 와 B0 는 같지 않을 수 있다. #323

Open
dakeshi opened this issue Mar 6, 2018 · 0 comments
Open

type identity. B0 와 B0 는 같지 않을 수 있다. #323

dakeshi opened this issue Mar 6, 2018 · 0 comments
Labels
reference 참고자료, 보충 설명 issue

Comments

@dakeshi
Copy link
Contributor

dakeshi commented Mar 6, 2018

type (
	A0 = []string
	A1 = A0
	A2 = struct{ a, b int }
	A3 = int
	A4 = func(A3, float64) *A0
	A5 = func(x int, _ float64) *[]string
)

type (
	B0 A0
	B1 []string
	B2 struct{ a, b int }
	B3 struct{ a, c int }
	B4 func(int, float64) *B0
	B5 func(x int, y float64) *A1
)

type	C0 = B0

1.9 버전에서는 B0, B0, C0 가 identical type 이라고 설명했습니다. 많은 사람들이 B0 가 중복으로 사용되었기 때문에 typo 에러로 버그 레포팅을 했는데 griesemer 의 설명에 따르면 B0와 B0가 항상 identical type은 아닙니다. 예문에서는 B0와 B0가 identical type이기 때문에 B0, B0, C0 가 identical type 이다 라고 설명하는게 문제가 없다고 언급했습니다.

아래는 griesemer가 설명한 내용입니다.(golang/go#22495 (comment))

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.

그의 설명 이후에도 동일한 내용의 버그 레포팅이 반복되자 독자들의 혼동을 피하기 위해 1.10 에서는
B0, C0 는 identical type 이다라고 구문이 변경되었습니다.

관련 commit: golang/go@c13e0e8

@dakeshi dakeshi added the reference 참고자료, 보충 설명 issue label Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reference 참고자료, 보충 설명 issue
Projects
None yet
Development

No branches or pull requests

1 participant