5 ms·
> - the lazy evaluation means it can be used for things like logging (which really want lazy evaluation) Could you elaborate? I would find it rather surprising
by codethief 2y ago
> - the lazy evaluation means it can be used for things like logging (which really want lazy evaluation)
Could you elaborate? I would find it rather surprising if my log messages don't contain the data at the very moment I invoke the logger.
- masklinn 2y agoThe expressions for the data you want to log out can be expensive, so ideally you only want to compute them after you’ve checked if the logger was enabled for the level you need. In most APIs this requires an explicit conditional check and the average developer will not think of it. This allows said check to be performed internally.
- skywhopper 2y agoYou can’t get log4j-style security crises with eager evaluation.