Freddo@feddit.nu to Programmer Humor@programming.devEnglish · 6 个月前OOP at home:feddit.nuimagemessage-square89fedilinkarrow-up1341
arrow-up1341imageOOP at home:feddit.nuFreddo@feddit.nu to Programmer Humor@programming.devEnglish · 6 个月前message-square89fedilink
minus-squareFlipper@feddit.orglinkfedilinkarrow-up41·6 个月前Deref is for smart pointers and not for inheritance.
minus-squarePhoenix3875@lemmy.worldlinkfedilinkarrow-up22·6 个月前Let me introduce you to this horror story: Deref Polymorphism https://rust-unofficial.github.io/patterns/anti_patterns/deref.html
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up4·6 个月前The windows crate is full of Deref. Because the windows API is full of inheritance. It may not be what the trait was thought of for, but I’m glad we have it to interface with APIs that have actual inheritance.
Deref is for smart pointers and not for inheritance.
Let me introduce you to this horror story: Deref Polymorphism https://rust-unofficial.github.io/patterns/anti_patterns/deref.html
The
windowscrate is full of Deref. Because the windows API is full of inheritance.It may not be what the trait was thought of for, but I’m glad we have it to interface with APIs that have actual inheritance.
Also sometimes newtypes