3 ms·
> Except that it's not. Global variables aren't initialised lazily Depends on the language, and the global. In java, a static attribute is initialised when th
by masklinn 13y ago
> Except that it's not. Global variables aren't initialised lazily
Depends on the language, and the global.
In java, a static attribute is initialised when the class is first used. Until the class itself is accessed and used, the attribute remains uninitialized.
In clojure, delay[0] will invoke (and cache) its body the first time it's deref'd.
[0] http://clojuredocs.org/clojure_core/clojure.core/delay http://clojuredocs.org/clojure_core/clojure.core/delay