3 ms·
Your lame idiom example in java is why I love Lua so much: log.debug(debugIsEnabled and "yo expensive" or "yikes!")
by fit2rule 12y ago
Your lame idiom example in java is why I love Lua so much:
log.debug(debugIsEnabled and "yo expensive" or "yikes!")
- sirclueless 12y agoCalling log.debug() with and argument of `false` is a no-op? That sounds like someone bending the language to fit an idiom, because it doesn't sound like a sane API except that it enables this use case.
- spacemanmatt 12y agoIt is insane in an eager-evaluated calling context. You're not wrong. But in Lisp it's not insane at all to let a macro consume a parameter and yield a no-op. Think of how this plays with a JIT and having code that can dynamically switch between dev/QA/production behavior and performance profiles, just for one example.