freddo@feddit.nu to Programmer Humor@programming.devEnglish · 2 days agoOOP at home:feddit.nuimagemessage-square80linkfedilinkarrow-up1337arrow-down115
arrow-up1322arrow-down1imageOOP at home:feddit.nufreddo@feddit.nu to Programmer Humor@programming.devEnglish · 2 days agomessage-square80linkfedilink
minus-squareFlipper@feddit.orglinkfedilinkarrow-up41·2 days agoDeref is for smart pointers and not for inheritance.
minus-squarePhoenix3875@lemmy.worldlinkfedilinkarrow-up22·2 days 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 days 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