2 ms·
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); Withou
by zamalek 2y 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).
- chrisco255 2y agoChanging the type on a value is an anti-pattern, in my opinion. It's not obnoxious to be explicit in your variable names.