Re: Objects.newIdentity update
I understand your frustration, but the claims you make here in defense of "identity" are not right. Value-based classes can (and currently do) have identity; VBC means that it is a mistake to _depend_ on that identity. (Same as with Integer boxes.) Similarly, lambdas may have identity, but the system makes no guarantees about the identity of the object that results from evaluating a lambda expression. Not all objects have an identity, we have already introduced value based class https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/doc-files/ValueBased.html a long time ago. The JLS also says that lambdas have no identity. First, i believe there is a problem of communication somewhere, the fact that newIdentity() returns new Object() is not important, we all now, and this is especially true for people dealing with the core libraries that implementations change. In a sense, it's normal to have a discussion about what identity means and Object being the root of everything, because introducing Objects.newIdentity() is a move to make current developers more aware of that. We have started that discussion with the introduction of value based class, more recently with JEP 390, Objects.newIdentity() is just the continuation of the logic of delivering features in pieces. With that in mind, not adding Objects.newIdentity() now seems shortsighted. Rémi [1] https://openjdk.java.net/jeps/390
Re: Objects.newIdentity update
- Original Message - > From: "daniel smith" > To: "valhalla-spec-experts" > Cc: "Roger Riggs" > Sent: Lundi 19 Juillet 2021 19:59:03 > Subject: Objects.newIdentity update [I've added Mark in CC] > An update on Objects.newIdentity for Java 17: Roger did some work to put the > feature together and get it reviewed. > > https://bugs.openjdk.java.net/browse/JDK-8269096 > > However, while the implementation is straightforward, for libraries folks not > deeply familiar with the Valhalla Project, the concept of a method that does > the same thing as 'new Object()' did not seem particularly justified. I think > they're especially uncomfortable with the idea of talking about creating an > "identity" in a world in which all objects have identity. > > https://bugs.openjdk.java.net/browse/JDK-8269097 Not all objects have an identity, we have already introduced value based class https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/doc-files/ValueBased.html a long time ago. The JLS also says that lambdas have no identity. First, i believe there is a problem of communication somewhere, the fact that newIdentity() returns new Object() is not important, we all now, and this is especially true for people dealing with the core libraries that implementations change. In a sense, it's normal to have a discussion about what identity means and Object being the root of everything, because introducing Objects.newIdentity() is a move to make current developers more aware of that. We have started that discussion with the introduction of value based class, more recently with JEP 390, Objects.newIdentity() is just the continuation of the logic of delivering features in pieces. With that in mind, not adding Objects.newIdentity() now seems shortsighted. Rémi [1] https://openjdk.java.net/jeps/390
Objects.newIdentity update
An update on Objects.newIdentity for Java 17: Roger did some work to put the feature together and get it reviewed. https://bugs.openjdk.java.net/browse/JDK-8269096 However, while the implementation is straightforward, for libraries folks not deeply familiar with the Valhalla Project, the concept of a method that does the same thing as 'new Object()' did not seem particularly justified. I think they're especially uncomfortable with the idea of talking about creating an "identity" in a world in which all objects have identity. https://bugs.openjdk.java.net/browse/JDK-8269097 So, not going to work out for this release. We made a bet that it would be a simple, noncontroversial matter to slip in an extra method, but it turns out to be a tougher sell than we thought. Of course, as part of JEP 401, a feature like this will have the surrounding context, with things like the IdentityObject interface, so that it will make a lot more sense. We'll plan for that.