wonder Expert Licensed User Longtime User May 8, 2019 #1 Comparing an object with Null (or null object) works, but comparing Null with an object doesn't work. Is this normal? Here's Python for comparison (no errors): It happens in both B4A and B4J. Another example: B4X: Dim A As Object Dim B As Map B.Initialize Log(A == B.GetDefault("KEY", Null)) 'Works Log(B.GetDefault("KEY", Null) == A) 'Crashes Last edited: May 8, 2019
Comparing an object with Null (or null object) works, but comparing Null with an object doesn't work. Is this normal? Here's Python for comparison (no errors): It happens in both B4A and B4J. Another example: B4X: Dim A As Object Dim B As Map B.Initialize Log(A == B.GetDefault("KEY", Null)) 'Works Log(B.GetDefault("KEY", Null) == A) 'Crashes
Erel B4X founder Staff member Licensed User Longtime User May 9, 2019 #2 This is expected as the = operator is not implemented as an identity comparison (with one exception, when the right side is the Null keyword).
This is expected as the = operator is not implemented as an identity comparison (with one exception, when the right side is the Null keyword).