-
Notifications
You must be signed in to change notification settings - Fork 5
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
타입으로 견고하게 다형성으로 유연하게 2주차 - 이정안 #459
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "\uD0C0\uC785\uC73C\uB85C-\uACAC\uACE0\uD558\uAC8C-\uB2E4\uD615\uC131\uC73C\uB85C-\uC720\uC5F0\uD558\uAC8C-2\uC8FC\uCC28---\uC774\uC815\uC548"
Conversation
우측에 있는 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
이름에 의한 서브 타입은 익숙한 반면 구조에 의한 서브 타입은 낮설게 느껴졌습니다. 두 서브타입 모두 목적은 결국 다형성을 제공한다는 것이지만 구조에 의한 서브 타입은 지나치게 유연한게 아닌가 라는 생각도 듭니다. *한편으로는 직관적이고 더 단순하고 명확하다는 생각도 듭니다* | ||
|
||
제가 사용하는 언어는 C#이면서 이름에 의한 서브 타입 관계를 사용합니다. 또한, 인터페이스라는 개념으로도 서브타입을 나타낼 수 있는데 인터페이스는 어떠한 **행위**를 추상적으로 정의하여 다형성을 나타냅니다. C#의 관점으로 책에서 보여지는 구조에 의한 서브 타입이 가능한가? 라는 생각이 듭니다. | ||
|
||
책에서 보여주는 예제는 필드에 해당되기에 속성만 같으면 같은 타입으로 인정한다 라는 개념이 이해는 되지만, 그것이 메서드나 행위에 해당될 때는 다르지 않을까? 궁금합니다. 같은 메서드를 시그니처로 판단하는지, 함수 내부 구현부가 다르다는 점으로 다형성을 나타내는건지? 저와 같은 생각을 하신 분이나 생각이 있으시다면 같이 이야기해보면 좋을 것 같습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드도 같아서 TypeScript 같은 경우 duck typing이 가능합니다.
물론 메서드 시그니처가 맞아야 겠죠.
저도 이번 장을 읽고 TypeScript를 좀 코딩해 보니 나중에 기회가 되면 써봐야 겠다는 생각도 들었습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문 주신 내용을 잘 이해를 못해서, 답변을 못달았습니다 😢 모임 때 한번 더 설명해주시면 좋을것 같아요~
질문을 뽑기 정말 어려웠던 챕터 같습니다.