Lazy Evaluation vs Macros

后端 未结 5 1499
孤城傲影
孤城傲影 2020-12-23 01:50

I\'m used to lazy evaluation from Haskell, and find myself getting irritated with eager-by-default languages now that I\'ve used lazy evaluation properly. This is actually q

5条回答
  •  佛祖请我去吃肉
    2020-12-23 02:40

    Laziness is denotative, while macros are not. More precisely, if you add non-strictness to a denotative language, the result is still denotative, but if you add macros, the result isn't denotative. In other words, the meaning of an expression in a lazy pure language is a function solely of the meanings of the component expressions; while macros can yield semantically distinct results from semantically equal arguments.

    In this sense, macros are more powerful, while laziness is correspondingly more well-behaved semantically.

    Edit: more precisely, macros are non-denotative except with respect to the identity/trivial denotation (where the notion of "denotative" becomes vacuous).

提交回复
热议问题