Hacker News new | ask | show | jobs
by RcouF1uZ4gsC 2185 days ago
> and if you are logging sensitive information you’ll get in trouble.

This is one of the areas, where strong types can help you. Have all your sensitive information in separate types from your non-sensitive info. For example, if you store the user's name in a type called SensitiveString, you can write methods/traits/overloads/etc that can either make it a compile time error to log a a value of that type, or log a placeholder - ie "SenstiveInfoHidden*". This also helps ensure that you don't accidentally assign or append sensitive information to a non-sensitive variable. Put the compiler and type system to work for you.

1 comments

This sounds interesting, my only experience with Types is via TypeScript, would you mind sharing a really simple example of how this could work in TS? Or maybe some link/resources you think are appropiate for learning more on this topic, thanks!