|
|
|
|
|
by cubefox
173 days ago
|
|
> > For the tagged case you would have to change all(!) the call sites > Yeah, that's exactly why I want a tagged union; so when I make a change, the compiler tells me where I need to go to do updates to my system, instead of manually hunting around for all the sites. You don't have to do anything manually. There is nothing to do. Changing the return type of a function from String|Null to String is completely safe, the compiler knows that, so you don't have to do any "manual hunting" at call sites. |
|
I'm unfamiliar with typescript, so in that language I don't have an opinion either way, but in C, you pretty much always want the tag