freddo@feddit.nu to Programmer Humor@programming.devEnglish · 1 month agoOOP at home:feddit.nuimagemessage-square89linkfedilinkarrow-up1344arrow-down115
arrow-up1329arrow-down1imageOOP at home:feddit.nufreddo@feddit.nu to Programmer Humor@programming.devEnglish · 1 month agomessage-square89linkfedilink
minus-squareFlipper@feddit.orglinkfedilinkarrow-up41·1 month agoDeref is for smart pointers and not for inheritance.
minus-squarePhoenix3875@lemmy.worldlinkfedilinkarrow-up23·1 month 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·1 month 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