이 토픽에서 발견한 내용입니다.
참고로 러스트는 객체 지향 언어가 아니야[1] Trait은 인터페이스가 아니고 하스켈에서 유래된 타입 클래스와 더 유사해[2]. 러스트는 그렇기에 서브타입을 가지지 않고, LSP는 서브 타입의 관계에 대한 정의이기 때문에 러스트에 적용될 수 없어.[3] --Vladimir Matveev
물론 내가 말한대로 러스트는 다양한 객체지향 스타일의 추상화를 지원하고 trait은 상속을 허용하여 타입 계층과 유사한 것을 구성하지.[4] 내게 있어서 객체지향이 러스트의 주요 패러다임이 아니더라도 자연스럽게 trait 객체가 LSP를 지원하는 것처럼 보여.[5]- ↑ As a side note: Rust is not object-oriented language
- ↑ Traits are not interfaces, they are more like type classes from haskell.
- ↑ Rust also does not have subtyping, so LSP is somewhat inapplicable to it because its definition is tied to the subtyping relationship
- ↑ Still, as I said, Rust supports a lot of OO-style abstractions, and traits are allowed to inherit, forming something akin to a type hierarchy
- ↑ For me, it would seem natural to support LSP for trait objects, even if OO isn't the main paradigm of the language.