freddo@feddit.nu to Programmer Humor@programming.devEnglish · 2 months agoOOP at home:feddit.nuimagemessage-square89fedilinkarrow-up1338arrow-down115
arrow-up1323arrow-down1imageOOP at home:feddit.nufreddo@feddit.nu to Programmer Humor@programming.devEnglish · 2 months agomessage-square89fedilink
minus-squareFlipper@feddit.orglinkfedilinkarrow-up41·2 months agoDeref is for smart pointers and not for inheritance.
minus-squarePhoenix3875@lemmy.worldlinkfedilinkarrow-up22·2 months agoLet me introduce you to this horror story: Deref Polymorphism https://rust-unofficial.github.io/patterns/anti_patterns/deref.html
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up4·2 months agoThe 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