Search code examples
terminologylazy-loadinglazy-evaluation

What's the difference between lazy loading and lazy evaluation?


Is there a difference between "lazy loading" and "lazy evaluation" (both of which are tags on Stack Overflow), or are they synonymous?

Response to comment: The tag wikis (which I'd looked at before asking the question) has the former referring to deferring of initialization, and the other talked about deferring of evaluation. Is it possible to initialize something without evaluating it?


Solution

  • lazy evaluation refers to how expressions are evaluated. For example:

    f(x) && g(x)
    

    g(x) will not be called unless f(x) is true.

    Lazy loading refers to initializing objects only when they are needed