Hacker News new | ask | show | jobs
by zamalek 498 days ago
The example given isn't that great. Here's a significantly more common one:

    var age = get_string_from_somewhere();
    var age = parse_to_int(age);
Without same-scope shadowing you end up with the obnoxious:

    var age_string = get_string_from_somewhere();
    var age = parse_to_int(age_string);
Note that your current language probably does allow shadowing: in nested scopes (closures).
1 comments

Changing the type on a value is an anti-pattern, in my opinion. It's not obnoxious to be explicit in your variable names.
That implies that Hungarian notation is not obnoxious? Sure, that's a fine opinion to have, but I guarantee it is an exceedingly rare one.
If you're writing in a language without strong type checking, Hungarian notation makes sense.