3 ms·
Already in Lisp for decades: (let (x y z) (list x y z)) -> (nil nil nil). However, nil has a distinct type. Thus: (let (x) ;; not initialized ;; ...
by kazinator 8y ago
Already in Lisp for decades: (let (x y z) (list x y z)) -> (nil nil nil).
However, nil has a distinct type. Thus:
(let (x) ;; not initialized
;; ...
(when condition
(setf x ...))
(numeric-code x)) ;; still blows up if condition was false
In other words, this initialization doesn't create a big risk of hiding errors due to initialization with a correctly typed bogus value that could be inappropriate.
nil is the empty list. The risk of a bug where a local variable holds an empty list that should have been initialized to some non-empty list seems low.
nil is also Boolean false. The risk of a bug where a local Boolean variable was implicitly initialized to false, but should have been true, also seems low.