Re:Golang generics proposal has been accepted
by pjungwir on Wednesday February 10, 2021 @03:52PM
(#26094612)
I've been experimenting with Rust's Rocket webapp framework, and as much as I like it, I agree it's very annoying how a struct can't permit nulls in one context but not another. I wish there were an easy solution that didn't require near-identical struct definitions and excess copying memory from one place to another.
[ Parent
| on HN ]
Re:Golang generics proposal has been accepted
by sdfsfsf3kjdf on Wednesday February 10, 2021 @04:18PM
(#26094949)
In Rust you can solve this via derive or a macro. Typescript's conditional types and the associated utility types are a nice solution to this problem as well. You can do a ton with Partial, Required, Pick, Omit, Exclude etc.