I'm at the point of being bothered that so many languages don't default to pure functions with required indication for impure. Like, why make me think about whether I'm writing an actual function or not?
Conversation
And maybe basic logging should count as introspection rather than an actual side effect, so maybe can call it pure? If so, logging is more fundamental than printing to stdout, which is user interface.
2
3
I guess it might be tricky to have a general rule for this (lots of types of applications with different needs), but I thought this was an interesting perspective:
Quote Tweet
Replying to @alpha_convert
Not sure about modules, but one thing I've found is that most modules in most projects shouldn't be logging at all.
Logging makes sense in the parts of the code that actually do stuff (IO) and have the full context. The pure logic parts of the code shouldn't know about logging.
2
2
Effects and handlers (like in Koka, Effekt, Frank, Unison) also allow you to 'intercept' effectful operations with effect handlers, potentially letting you add new effects, which could be helpful for adding logging separate to application logic?
I do think adding 'printf debugging' should be ok (in development) however, similar to this train of thought by Jon Sterling, in this case about how it should be possible to break abstraction boundaries for debugging purposes: twitter.com/jonmsterling/s
This Tweet is unavailable.
2


