News for hackers. Stuff that matters.
Re:Names are not type safety (2020) by chiffaa on Monday August 04, 2025 @01:56AM (#44782496)
I want to point out that, technically, using Deref for this is an anti-pattern, as Deref is intended exclusively for smart pointers. Nothing really wrong with doing this outside of some loss in opacity (and unexpected behaviour if you're writing a library), but it's worth pointing out
Re:Names are not type safety (2020) by OptionOfT on Monday August 04, 2025 @02:05PM (#44789420)
Re:Names are not type safety (2020) by nixpulvis on Monday August 04, 2025 @02:32PM (#44789731)
I don't really see the issue in providing Deref for a wrapper type like this. Could you elaborate? I'm not trying to gain full encapsulation, just trying to make sure I'm passing the right kind of wrapper, then using it transparently.