News for hackers. Stuff that matters.
Re:Is your programming language unreasonable? (2015) by elihu on Saturday October 10, 2020 @04:36PM (#24741722)
A couple other counterexamples to

> "Records with the same internal data ARE equal by default"

Floats: floating point equality tests between two floats of the same value or testing equality with itself is generally "true" with the exception of NaN (i.e. "not a number") values. Testing if NaN == Nan is "false" according to the IEEE [1]. (Probably not all languages follow IEEE's recommendation.)

Functions: some functions are trivially the same, and some functions are trivially different, but deciding whether arbitrary functions (for instance, f(x) { x + x } and f(x) { 2*x } return the same values and have the same side-effects for all possible inputs is generally not something a compiler should be expected to do. So any record with a function as a field can't really be tested for equality.

[1] https://stackoverflow.com/questions/38798791/nan-comparison-...

There are no comments on this comment yet.