logoalt Hacker News

__MatrixMan__ • today at 2:35 PM • 1 reply • view on HN

PSA: you can typically declare different types of string so that your type system objects to mixing data of different types even though deep down we know they're both strings.


Replies

BoppreH • today at 3:28 PM

If you mean type aliases, that's a good idea within a single codebase, but the distinction between different types of strings doesn't survive serialization so it wouldn't have prevented this error. What they need is a way to signal errors out-of-band, like Result<T> or exceptions.

➕ show 2 replies