3 ms·
> also can’t really explain why it was so great I like it when assertTrue (f x) -- passes in test means that assertTrue (f x) -- passes in prod
by mrkeen 2y ago
> also can’t really explain why it was so great
I like it when
assertTrue (f x) -- passes in test
means that
assertTrue (f x) -- passes in prod
- shermantanktop 2y agoIs there a language where that isn’t the case?
- mrkeen 2y agoApproximately all of them. The property is "referential transparency", and it's such a sensible thing to have that people assume they already have it (per your question). The "test/prod" was an unnecessary detail - there's really nothing saying that f(x) will equal f(x) in most languages in most circumstances! It can return different things on repeated calls to it, it can behave differently if two threads call into it at once. It's a major part of the reason people don't see the appeal of Haskell. They think they already have "type-safety" and "functional stuff" and "generics" and "null-safety" - but it's really not the same.