Thank you for submitting this article. I have the following questions/remarks:
"A common approach in the imperative/OO world is to use dependency injection (or plain old interfaces) to separate the logging API from its implementation. However, the resulting code still causes side effects."
dummy does not cause a side effect, does it?
'2. If the function in your example causes an exception for some reason only the exception is shown but not the log statements up to this point.
You're right that dummy doesn't cause a side-effect, because it throws away its input. We're more interested here in logging functions that actually produce a log in the end.
Yes, it's probably not a good idea to mix plain .NET exceptions with the sort of pure functional effect handling described here. At some point in the future, exceptions will perhaps become just another kind of pure functional effect, but we're not there yet.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for submitting this article. I have the following questions/remarks:
dummy
does not cause a side effect, does it?'2. If the function in your example causes an exception for some reason only the exception is shown but not the log statements up to this point.
You're right that
dummy
doesn't cause a side-effect, because it throws away its input. We're more interested here in logging functions that actually produce a log in the end.Yes, it's probably not a good idea to mix plain .NET exceptions with the sort of pure functional effect handling described here. At some point in the future, exceptions will perhaps become just another kind of pure functional effect, but we're not there yet.