3 ms·
> If this is something you need, it smells like "runtime checking" not amending the type system. This is both! The primary point of branded types is to allow y
by tshaddox 3y ago
> If this is something you need, it smells like "runtime checking" not amending the type system.
This is both! The primary point of branded types is to allow you to use the type system to ensure that a particular runtime check has taken place.
- dvt 3y ago> The primary point of branded types is to allow you to use the type system to ensure that a particular runtime check has taken place. I see. This is kind of cool, though the branding can still be broken via down-the-stream mutations. Would be nice to enforce re-branding every time a variable is changed, but that seems like a lot of overhead.
- tshaddox 3y ago> the branding can still be broken via down-the-stream mutations Only for mutable values! A branded string should be as immutable as they come, right?