Hacker News new | past | comments | ask | show | jobs | submit
Awesome, how do you ensure clients of your code always do the correct operations on your data?

With static types it's obvious and you generally have to work hard (and in non intuitive ways) to mess up.

This becomes more important as team sizes grow.

> Awesome, how do you ensure clients of your code always do the correct operations on your data?

Either the data type is opaque (as in you shouldn’t mess with it and you should use the provided api) or it’s just normal primitives and thus no restrictions.

You don’t usually reach into data structures to modify their properties, especially if it’s for foreign modules.