3 ms·
If no mainstream programming languages implement equals like math—an obvious and well known example throughout the history of computing—maybe it’s because that’
by earthboundkid 7y ago
If no mainstream programming languages implement equals like math—an obvious and well known example throughout the history of computing—maybe it’s because that’s a bad idea.
- rossdavidh 7y agoOr really hard, when you're communicating with a computer and not another human. Lots of concepts that are easy to communicate to a human, are difficult to communicate to a computer, not just equality. It is a good point, though, that if virtually EVERY mainstream language gets it wrong, when every single one of the people creating those languages knew about the math =, there has to be a reason.
- dajohnson89 7y agoand what might that reason be?
- TheOtherHobbes 7y agoIt depends what the meaning of "is" is.
- earthboundkid 7y agoPhilosophers distinguish three senses of "is": - Identity: "Clark Kent is Superman." Anything true of Superman is true of Clark Kent and vice versa, since these are two names for the same thing. - Predication: "Superman's cape is red." Red is a quality of the cape. It's not reflexive because not all red things are capes. - Existence: "There is no Superman." In English, existence sentences usually begin with "there is" or more poetically, you say "Superman is ~not~." Existence is not a relation. In the case of Clinton, he was being evasive about "is" versus "was" in the time dimension. There was a sexual relationship between him and Lewinski, but he called there "is" no relationship in general.
- moring 7y agoIt's because they are dealing with different things. In math, things are immutable, so you either "compare all fields" for the most fine-grained equality, or a more "coarse" equality that is compatible in the sense that if two things are "finely equal", they are implied to be "coarsely equal". In programming, on the other hand, you have variables that change their value over time. Many, many problems with equality have to do with how they interact with time and change. Those languages that stay away from (implicit) time and change, such as Haskell, don't have the same problems with equality. They do have other problems with equality being undecidable, which results in some types not being able to derive equality (especially functions, since automatically derived equality would mean to solve the halting problem).