4 ms·
Yeah, that particular case got better with generics. It's still more verbose to write ptr.To(true) than &true though. Unfortunately, there's no generic type co
by kbolino 2y ago
Yeah, that particular case got better with generics. It's still more verbose to write ptr.To(true) than &true though.
Unfortunately, there's no generic type constraint for "is an interface" or even "is nilable" so you can't use generics to solve nil-safety issues in general.
- jen20 2y agoIndeed, I see no reason why taking the address of a literal couldn’t be added though, that’s a cheap win.