Post 9rmOOS1mvYnyrlyZdI by hunter@niu.moe
 (DIR) More posts by hunter@niu.moe
 (DIR) Post #9rmOOS1mvYnyrlyZdI by hunter@niu.moe
       2020-02-07T00:32:50Z
       
       0 likes, 0 repeats
       
       I learned today that in Java `==` does pointer comparison rather than value comparison. I've never understood why you would want pointer comparison as the default, I feel that value comparison is far more common and the expected behavior. Pointer comparision is useful but I would expect it to be a method instead.
       
 (DIR) Post #9rmOOTdOxCUDqia7to by cutscenes@shitposter.club
       2020-02-07T01:53:18.512722Z
       
       0 likes, 0 repeats
       
       @hunter I'd be surprised if looking up a method on an object just so you can do a pointer comparison were sensible.Regardless I'm in favour of having both as core parts of any language. If one were to do value comparison against a pile of 1MB strings a whole bunch of times, things would get somewhat ridiculous, so it makes sense to some extent to have it available.Python uses the `is` operator for pointer comparison. If you want a good example on how to do equality at the very least, Python is a good example. (As for what it treats as true or false, Python is a bad example.)