News for hackers. Stuff that matters.
Re:Things Go needs more than generics by fauigerzigerk on Monday October 04, 2021 @10:40AM (#28747336)
Non-nullable types allow functions to put the burden of checking for the existence of a value on callers. That means the check only has to happen in one place instead of everywhere a string is used.

But I sort of agree that excluding nulls is only part of the solution, because existing isn't the only requirement that values have to meet. I often need strings to be non-empty or have a minimum length.

Many modern type systems allow you to define new types that conform to an existing type's interface. But it's often a rather convoluted affair.

There are no comments on this comment yet.