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

empty method set #326

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

empty method set #326

dakeshi opened this issue Mar 20, 2018 · 0 comments
Labels
review discussion 리뷰과정에서 주고받은 의견들

Comments

@dakeshi
Copy link
Contributor

dakeshi commented Mar 20, 2018

empty method sets 관련 리뷰 토론 내용을 기록합니다.

method sets 챕터에 다음과 같은 문장이 있습니다.

Any other type has an empty method set.

@dakeshi
interface {} 의 경우 empty interface 라고 부르는데 interface 타입은 method sets = its interface 이기 때문에 empty method set 이라고도 부를 수 있을 것 같아서요. 저 문장에서 any other type 의 기준점이 되는 type이 어떤 것인지 모르겠습니다.

@jhonghee
nterface{} 는 non-empty method set을 가지는 타입에 대해서도 적용가능합니다.
Any other type has an empty method set. 은 그 위에 나열된 non-empty method set를 가지는 타입에 반하는 의미로 쓰인 것 같으네요.

예를 들어 기본 타입인 int의 경우 특별히 타입 정의 (type definition)를 통해 이름을 주고 메서드를 선언하지 않는 이상 empty method set을 가지고 있는 것으로 볼 수 있을 것 같습니다.

@dakeshi
https://tour.golang.org/methods/14 tour 에도 언급이 되어 있군요.

Every type implements at least zero methods.

Any other type has an empty method set. 이 문장보다 좀 더 명확한 것 같아요.

음. implement 와는 다르게 봐야하나요. tour는 implement을 말하고 empty method set은 type definition 과 method definition 개념으로 봐야할 것도 같기도 하네요.

@jhonghee
"at least" 라는 말이 중요한 것 같아요.
0개 이상...
모든 타입이 0개 이상의 메서드를 구현한다고 보기 때문에 interface{} 가 적용 가능한 것이죠.

@dakeshi dakeshi added the reference 참고자료, 보충 설명 issue label Mar 20, 2018
@dakeshi dakeshi changed the title empty method sets empty method set Mar 20, 2018
@dakeshi dakeshi added review discussion 리뷰과정에서 주고받은 의견들 and removed reference 참고자료, 보충 설명 issue labels Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review discussion 리뷰과정에서 주고받은 의견들
Projects
None yet
Development

No branches or pull requests

1 participant