I finished the interpreter challenge but then when going back through my code to clean it up, I noticed I get this wrong. Curious if others have run into this too.
fun f() {}
var g = f;
print (f == g);
among other cases. It seems like this is probably pretty easy to get right in Java because the semantics are pretty similar. But as I understand it, Rust doesn’t really encourage you to ask if two objects are actually “the same object” (like Java ==) but only if they’re considered equal according to however you implemented the Eq trait (like Java .equals()). And if you derive it you can end up with two objects being “equal” because they look identical, but according to the Lox semantics they should be considered different objects.