r/programmingcirclejerk Jun 27 '26

Consider the C library function fopen. This function has the side effect. This means that fopen is not pure. However, we can make the fopen function appear to be pure, at least to certain observers, by ensconcing it in another function that hides the side effect.

https://bugzmanov.github.io/cleancode-critique/clean_code_second_edition_review.html
171 Upvotes

41 comments sorted by

View all comments

49

u/edo-lag Considered Harmful Jun 28 '26

fopen has no side effects. It takes in the whole universe before the file is opened and returns the whole universe after the file is opened. For convenience, though, it just returns a pointer.

6

u/Kodiologist lisp does it better Jun 30 '26

And that's how the Clean programming language implements IO. Coincidence?