Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
mdanger007
7y ago
0 comments
Save
Share
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
0 comments
2 comments · 2 top-level
top
newest
oldest
Nullabillity
7y ago
Absolutely, and Option<T>s are great for modelling that. It just shouldn't be the default.
whateveracct
7y ago
If it's useful, then the person creating the struct can explicitly set it to nil.
j
/
k
navigate · click thread line to collapse