News for hackers. Stuff that matters.
Re:Making Wrong Code Look Wrong (2005) by dragonwriter on Saturday November 09, 2019 @02:33AM (#21490192)
> No compiler can know that a string variable is a "name" or a "password".

In pretty much any language supporting user-defined types and/or type aliases, types can be used for that information (with aliases, providing documentation the same as hungarian notation does; with real types, providing the possibility for enforced protection against accidental misuse.)

But the article doesn't actually use hungarian notation for that kind of thing, it uses it for traits that are not "what it does", but instead metadata analogous to Ruby's "taint". Which, again, is something easily encoded in typing, in a static language, either as a core feature of typing or via user-defined (possibly wrapper, depending on other features of the type system or general language semantics) types; type aliases, even, would work as well as hungarian notation, but using actual types lets you put guarantees in place rather than just providing documentation.

There are no comments on this comment yet.