Hacker News new | past | comments | ask | show | jobs | submit login

> 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





Is there a language where that isn’t the case?

Approximately 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: