Hi Stephen, > > (This is quite separate to putting constants on the left when > > testing equality to detect accidental use of assignment instead of > > comparison: ‘10 == x’. That just remains weird and has dropped out > > of fashion as compilers now warn of ‘x = 10’ as a test.) > > And the craziness of JavaScript’s two equality operators ‘==‘ equal > after type conversion and ‘===‘ really equal!
PHP grew something similar because its ‘==’ did too much in an attempt to be helpful. I always go for the long-form === if possible to show what I expect as the writer and to pass that information on to the reader. I prefer Go's approach where explicit casts are required if anything too magical is required to compare values. This fails to compile with ‘invalid operation: i == u (mismatched types int32 and uint32)’. var ( i int32 u uint32 ) fmt.Println(i == u) -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2025-09-02 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... https://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk