|
|
|
|
|
by dnautics
2015 days ago
|
|
Broadly speaking it's not bad if your null or undefined value has a different type than the shadowed type. The two examples in statically typed languages I can think of is rust and zig; in dynamically typed languages I think of elixir (which assigns it to an atom, and is a crash-fast language), and ruby (nil is it's own class) Of the languages I have experience with, it's a major problem in C, java, and javascript. For javascript specifically there is also the issue of falsey discipline; there are a ton of falsey values so you could get tripped up in ways you forgot about when doing a null check. |
|