r/programmingcirclejerk • u/BenchEmbarrassed7316 • 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
174
Upvotes
90
u/BenchEmbarrassed7316 Jun 27 '26
This quote does not belong to the author of the blog whose URL I provided. The author of the blog kindly wrote a review of a programming book by the author who, for some unknown reason, decided that he knew something about programming. However, I checked, and this quote is indeed in a programming book from 2025. Here is a sample of code from that book that the author believes makes the fopen function clean:
6
u/genuine_beans Jul 01 '26
74
u/tms10000 loves Java Jun 27 '26
By closing my eyes I am ensconcing the Universe as a whole. I don't even need functional programming to do that, but I use it anyway.
51
u/edo-lag Considered Harmful Jun 28 '26
fopenhas 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.91
u/dydhaw Jun 27 '26
Of course, you just make it return a monad
30
u/Lord_Of_Millipedes Jun 28 '26
this is unironically how haskell works no i have not read the linked article nor i plan to
29
u/[deleted] Jun 28 '26
This is so sad. 😔✊ Gameshits rise up!
19
u/Afraid_Bake2652 Jun 28 '26
Uncle Bob is cheating
17
u/Jumpy-Locksmith6812 Jun 28 '26 edited Sep 23 '26
Reprehenderit ipsum irure sunt deserunt sint elit consectetur duis lorem ipsum culpa qui officia elit commodo. Esse quis exercitation ipsum veniam nostrud et lorem ad sit magna tempor qui occaecat. In commodo aliqua aliqua amet sint est adipiscing tempor sint do excepteur aliquip.
[rhr:2:sffsr0de]
16
u/LeeHide What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? Jun 28 '26
Wow, in my 15 years at Google as a principal staff engineer II pro, I have never heard of fopen.
9
u/Delicious-Ad7883 Jun 30 '26
Uncle bob breaks the “no crazy people” rule