Follow

What's a good naming convention for functions that wrap an enabling flag?

Like, it writes to the log, but only if logging is enabled.

writeLog obscures the conditional and writeLogIfEnabled seems excessive.

@WomanCorn Why not just a decorator called log, and in the decorator it references a setting that you can set to enable or disable? My mind is thinking Python, but whatever syntactic sugar equivalent for your language of choice.

Sign in to participate in the conversation
Mastodon

a Schelling point for those who seek one