▲ | b_e_n_t_o_n 5 hours ago | ||||||||||||||||
Structurally typed languages can still support information hiding.
I guess the point is that you can model your domain using data as well as types. | |||||||||||||||||
▲ | lmm 5 hours ago | parent [-] | ||||||||||||||||
> Structurally typed languages can still support information hiding. But you haven't hidden the information, it's still a string. You can put the string in a wrapper struct but in a structural system that's not really any different from putting it a list or map - the data is still exposed, and if someone writes code to e.g. log objects by just enumerating all their fields (which is a very natural thing to do in those systems) then it will naturally print out your password and there's not really any way to make it ever not. > I guess the point is that you can model your domain using data as well as types. You want both in your toolbox though. Restricting yourself to only having types that are essentially lists, maps, or a handful of primitives has most of the same downsides as restricting yourself to not using types at all. | |||||||||||||||||
|