3 ms·
I don't know, because I don't use them that way. I used units in my example because everybody is used to seeing them but I'm regretting it now, because what I r
by jerf 13y ago
I don't know, because I don't use them that way. I used units in my example because everybody is used to seeing them but I'm regretting it now, because what I really use it for looks more like this:
type FirstName string
type LastName string
type SomeUniqueIdentifier uint32
type AnIdentifierInAnEntirelySeparateNamespace uint32
Usually I'm using it on types that I want to be fundamentally immiscible, like that, not units. The point is that I use the type system so that FirstName and LastName aren't just "string", and I can't cross up which thing gets passed to which function, ever, because the type system stops me. An error the compiler won't allow me to make at all is an error I can stop worrying about, and I have plenty to worry about. I can fit more useful things to worry about into my mental buffers if I don't have to carry around things the compiler can do not only as well as me, but better.