News for hackers. Stuff that matters.
Re:Interview Gone Wrong by alkonaut on Monday November 04, 2024 @02:49AM (#42039440)
What does A == B == C even mean? I mean I know what mathematically A=B=C means. That A, B and C are all equivalent.

But then is the mathematical '=' really a binary operator that maps two numerical inputs to a boolean output? It feels then as an abuse of notation if (A=B)=C doesn't allow A=B to change type?

Because I don't really have much use for a symbol that is some times doing a binary mapping from numbers to booleans and some times becomes some sort of ternary operator which maps 3 inputs to one boolean.

Re:Interview Gone Wrong by joveian on Monday November 04, 2024 @05:34PM (#42046719)
Maybe consider chained comparison operators early textual replacement along the lines of the C preprocessor, although the exact textual replacement would involve temporary variables to avoid multiple side effects and be more complicated than just "(a) == (b) and (b) == (c)". (a==b)==c does not expand, only the version without parentheses expands, so you can still do the boolean comparison if you want.