3 ms·
there are times when a nil struct field is useful, like for trees and json. very easy to require struct fields by using a constructor
by mdanger007 7y ago
there are times when a nil struct field is useful, like for trees and json. very easy to require struct fields by using a constructor
- Nullabillity 7y agoAbsolutely, and Option<T>s are great for modelling that. It just shouldn't be the default.
- whateveracct 7y agoIf it's useful, then the person creating the struct can explicitly set it to nil.