var i, s; if (random(1000) < 1) s = true else s = "hello world" s += iThere are plenty of much more realistic situations where the cause of the bug is not on the reported line; just because you can write a sample with that problem that just happens to use a feature doesn't mean the feature is in any way to blame. In fact, you can't even really blame it fully on dynamic typing, as the same thing can happen in statically typed languages.
On the other hand, I have already given several examples where value propagation is more concise:
foo = argument0 || default_value // default values when an argument is null bar = do_something() || handle_error() // also when some operation fails if (baz != 0 && some_condition(qux / baz)) // checking before performing an operation that can errorThere are more that may or may not apply depending on other changes, such as checking if an array index exists before using it, etc.
Edited by Rusky, 26 January 2012 - 01:01 AM.