Freddo@feddit.nu to Programmer Humor@programming.devEnglish · 18 hours agoOOP at home:feddit.nuimagemessage-square41fedilinkarrow-up1220
arrow-up1220imageOOP at home:feddit.nuFreddo@feddit.nu to Programmer Humor@programming.devEnglish · 18 hours agomessage-square41fedilink
minus-squareFlipper@feddit.orglinkfedilinkarrow-up35·18 hours agoDeref is for smart pointers and not for inheritance.
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up2·9 hours 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.
minus-squarePhoenix3875@lemmy.worldlinkfedilinkarrow-up18·16 hours agoLet me introduce you to this horror story: Deref Polymorphism https://rust-unofficial.github.io/patterns/anti_patterns/deref.html
Deref is for smart pointers and not for inheritance.
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.
Let me introduce you to this horror story: Deref Polymorphism https://rust-unofficial.github.io/patterns/anti_patterns/deref.html
Also sometimes newtypes