Very often in my code I do stuff like:
type Address = String; type Id = String;
This works well, and helps type names to better document the intention. However it does not prevent accidentally passing
There is a newtype approach to fix that (with crates like
shrinkwraprs), and I tried it, but it’s actually a PITA. Relying on
Deref etc. is just very not ergonomic. I want
Address to be exactly like
String, not “kinda-String”.
All I really want is to be able to define type alias that actually defines a new separate type, exactly like the original, but that can’t be accidentally mixed.
Are there any plans to support it? Any workarounds (that aren’t newtype-based) that I could try?