|
|
|
|
|
by nmrm
4442 days ago
|
|
The postscript is irrelevant to the claim made in the original post on this thread. It's a conflated example and not indicative of real programming. if "get" returns different values when called multiple times within a single expression, one of two things must be true:
* Someone's overriding "get" with a mutation to the variable. In all but the very rarest of circumstances, that someone should be publicly shamed. It's a nice hack for the purpose of the article, but not real code.
* there's some very fine-grained concurrency. This case is irrelevant to the OP's claim because concurrency of this sort is very likely a fundamental characteristic of the system at hand, and never an artifact of the language. |
|
Both solutions work the same way - when accessing the value of "b" for the first check, b is mutated such that the next check will return a different value. Both of them are equally bad practices.
The == vs. === issue is the part that's actually irrelevant, it served as a red herring.