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

타입으로 견고하게 다형성으로 유연하게 2주차 - 조현우 #460

Conversation

aquamagic9
Copy link
Contributor

타입으로 견고하게 다형성으로 유연하게 2주차 정리

이번 내용에서는 구조에 의한 서브 타입, 위치에 민감한 타입 검사 등 새로운 개념들에 대한 내용이 많아 정말 다양한 것들이 존재하는 구나 생각이 들었으며 흥미롭게 봤습니다.

Copy link

우측에 있는 Projects, Milestone, Development를 확인 후 할당 해주세요~! 🙇

Comment on lines +193 to +206
```cpp
Void write(Cell cell, String | Int data) {
if (data is String){
cell.setDataFormat(DATA_FORMAT_NORMAL);
cell.setData(data);
} else {
cell.setDataFormat(DATA_FORMAT_NUMBER);
cell.setData(intToString(data));
}
}
```
>이거나 타입은 사용할 때 주의해야 할 점이 있는데 data is String 가 아닌 Boolean isString(Any data) 와 같은 판별 메소드가 대신했다면 위치에 민감한 타입 검사라는 개념에 의해 타임 검사를 통과하지 못한다.

'위치에 민감한 타입 검사'와 같은 오류를 경험을 해보신 적이 있으신가요? 저 같은 경우 '위치에 민감한 타입 검사'라는 개념이 생소하기도 했고 이렇게 배우지 못하고 해당 오류를 마주한다면 'data is String과 Boolean isString(Any data)는 결국 같은 의미 같은데 왜 오류가 나지' 라는 생각으로 당황했을 것 같기도 합니다.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 해당 에러를 경험해본적은 없습니다 이번을 계기로 알게되어서 파이썬코드로 테스트해보는데, 저도 이런 상황겪었다면, 어디가 문제인지 잘 몰라서 당황했을 것 같네요

Copy link
Member

@jongfeel jongfeel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +204 to +206
>이거나 타입은 사용할 때 주의해야 할 점이 있는데 data is String 가 아닌 Boolean isString(Any data) 와 같은 판별 메소드가 대신했다면 위치에 민감한 타입 검사라는 개념에 의해 타임 검사를 통과하지 못한다.

'위치에 민감한 타입 검사'와 같은 오류를 경험을 해보신 적이 있으신가요? 저 같은 경우 '위치에 민감한 타입 검사'라는 개념이 생소하기도 했고 이렇게 배우지 못하고 해당 오류를 마주한다면 'data is String과 Boolean isString(Any data)는 결국 같은 의미 같은데 왜 오류가 나지' 라는 생각으로 당황했을 것 같기도 합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위치에 민감한 타입 검사는 저도 이름이 생소해서 몇 번 반복해서 읽어보긴 했습니다.
그게 용어가 생소할 뿐 사실 수학에서 "or" 개념하고 다르지 않아서
이번에도 저자의 생각대로 설명해주려고 하는 의도는 충분히 알게 되었습니다.

TypeScript를 써보지는 않아서 이런 문법이 가능한지 코딩해 보고 실행도 해 봤는데
타입이 정해져 있지 않다 타입 검사에 민감하다는 걸로 이해하긴 했습니다.

리뷰를 하다 보니 TypeScript를 써보면 당황하지 말아야 겠다는 생각도 드네요.

```
>이거나 타입은 사용할 때 주의해야 할 점이 있는데 data is String 가 아닌 Boolean isString(Any data) 와 같은 판별 메소드가 대신했다면 위치에 민감한 타입 검사라는 개념에 의해 타임 검사를 통과하지 못한다.

'위치에 민감한 타입 검사'와 같은 오류를 경험을 해보신 적이 있으신가요? 저 같은 경우 '위치에 민감한 타입 검사'라는 개념이 생소하기도 했고 이렇게 배우지 못하고 해당 오류를 마주한다면 'data is String과 Boolean isString(Any data)는 결국 같은 의미 같은데 왜 오류가 나지' 라는 생각으로 당황했을 것 같기도 합니다.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum type의 경우 모든 타입에 대해 처리를 했느냐를 볼 때가 있는데, flow상 어떤 값은 절대 처리될 수 없는데도 반드시 처리해야 한다고 오류를 뱉는 경우가 있어서 당황(?)한 적이 있었습니다. 다행히 오류는 아니고 warning 정도였지만, 추가로 코멘트로 문맥을 설명해야 하는 번거로움이 있었습니다.

@jongfeel jongfeel moved this to In review in 2025 Academic Conference Mar 7, 2025
@aquamagic9 aquamagic9 merged commit 634fae8 into main Apr 4, 2025
@aquamagic9 aquamagic9 deleted the 타입으로-견고하게-다형성으로-유연하게-2주차---조현우 branch April 4, 2025 15:07
@github-project-automation github-project-automation bot moved this from In review to Done in 2025 Academic Conference Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2025 타입으로 견고하게 다형성으로 유연하게 탄탄한 개발을 위한 씨줄과 날줄
Projects
Status: Done
7 participants