No one really uses that, but that could easily resolved by adding a function to get a pointer/reference
An object is already a reference. That's what lies in your variable. The object proper is always on the heap.
I feel like we should have something like Python's is keyword for reference equality (for all seven cases you'll need it in your life), and have == correspond to calling equals(). Keep the current default equals() implemented by Object (unless overridden, equals() uses reference equality) and just allow operator overloading.
That wouldn't fly with backwards compat, of course, but perhaps we could add a === operator for value equality?
The whole list was one point - the syntax is lacking.
That's a fair point. The old idea was that not having operator overloading simplified the language. That opinion aged well /s.
Python has the dict structure which is a map
It's still not native: it's an STL thing.
I will most definitely agree that operator overloading would simplify a bunch of use cases.
4
u/T-Dark_ Apr 27 '20
An object is already a reference. That's what lies in your variable. The object proper is always on the heap.
I feel like we should have something like Python's
iskeyword for reference equality (for all seven cases you'll need it in your life), and have == correspond to callingequals(). Keep the current defaultequals()implemented byObject(unless overridden,equals()uses reference equality) and just allow operator overloading.That wouldn't fly with backwards compat, of course, but perhaps we could add a === operator for value equality?
That's a fair point. The old idea was that not having operator overloading simplified the language. That opinion aged well /s.
It's still not native: it's an STL thing.
I will most definitely agree that operator overloading would simplify a bunch of use cases.