From davidalayachew at gmail.com Sun Oct 22 19:29:58 2023 From: davidalayachew at gmail.com (David Alayachew) Date: Sun, 22 Oct 2023 15:29:58 -0400 Subject: Is there a possibility of the string equality operator (==) being fixed? In-Reply-To: References: Message-ID: Hello, Thank you for reaching out! I'm pretty sure that the amber-dev mailing list is not the correct place for this type of question. This topic usually goes on at the following mailing list instead. I've CC'd it for you. I would also encourage you to remove amber-dev from your CC when responding to me, or anyone else on this thread. discuss at openjdk.org To answer your question, this is a very common request, and the biggest answer is definitely still the backwards compatibility problem. But tbh, the question I have for you is this -- is it such a big cost to call the o1.equals(o2) method instead of using ==? And if you want to handle nulls too, you can import java.util.Objects (that class is full of useful static utility methods) and then just say Objects.equals(o1, o2) instead. I am pretty sure that that exact method was created in response to your exact question. I understand it might be inconvenient, but making a change like you suggested would be very disruptive for very little benefit. All you would gain from doing this would be a slightly better syntax for representing object equality and a little more ease when it comes to teaching somebody Java. Is that really worth the effort? As for the class-file api, I'll CC them so that someone can fact check me. Assuming I'm not wrong (no one responds to that point specifically), I would also drop that mailing list from your CC when responding. The purpose of the Class-File API was to build and transform class files. So that seems unrelated to what you want. You want to repurpose old syntax, but syntax stops being relevant after compilation, and it is these compiled class files that the Class-File API deals in. If we tried to use that API to handle class files created with the old syntax, then we would have a migration and clarity problem, amongst much more. Let us know if you have any more questions. Thank you for your time! David Alayachew On Sun, Oct 22, 2023 at 2:12?PM tzengshinfu wrote: > Hi, folks: > > When I switched my primary programming language from C# to Java, I found > myself perplexed by 'string comparison' (and still do at times). While > string comparisons can sometimes become quite intricate, involving issues > like case sensitivity, cultural nuances... most of the time, all that's > needed is string1 == string2. > > I discovered that a similar question was asked a decade ago ( > https://www.reddit.com/r/java/comments/1gjwpu/will_the_equals_operator_ever_be_fixed_with/), > with responses indicating that it's due to 'Backward compatibility,' and > therefore, unlikely to change. (Backward compatibility! We just keep piling > new things on top of historical baggage, and for users coming from school > or from other languages like C#, Python, C++, Rust, Golang, Kotlin, Scala, > JavaScript, PHP, Rlang, Swift, Ruby, Dart... the top 20 languages according > to PYPL, having to consult the so-called 'Java FAQ' can be frustrating. > > But I believe that if something is amiss, it should be corrected to keep > moving forward. It would be fantastic if this issue could be addressed in a > new version of Java and an automatic conversion feature provided to fix > places in user code that use String.equals. (Similar to the JVM's preview > feature switch) Is the Class-File API a potential solution to this problem? > Is my idea unrealistic? > > /* GET BETTER EVERY DAY */ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.reinhold at oracle.com Mon Oct 23 15:49:47 2023 From: mark.reinhold at oracle.com (Mark Reinhold) Date: Mon, 23 Oct 2023 15:49:47 +0000 Subject: Is there a possibility of the string equality operator (==) being fixed? In-Reply-To: References: Message-ID: <20231023114945.393941906@eggemoggin.niobe.net> 2023/10/22 15:29:58 -0400, David Alayachew : > Hello, > > Thank you for reaching out! > > I'm pretty sure that the amber-dev mailing list is not the correct place > for this type of question. This topic usually goes on at the following > mailing list instead. I've CC'd it for you. I would also encourage you to > remove amber-dev from your CC when responding to me, or anyone else on this > thread. > > discuss at openjdk.org In fact, the discuss list is not appropriate for this type of question. Per the list?s description [1]: This list is for general discussion about the OpenJDK Community, including proposals of new Projects and Groups. This is not a place to discuss specific technical proposals. For that, please use an appropriate area-specific mailing list. This is not a place to ask support questions. Please direct those to whoever provided your JDK build. The OpenJDK Developers? Guide includes a list of area-specific mailing lists [2], but there isn?t a list specifically for the Java programming language. Given that the charter of Project Amber [3] is to ?explore and incubate smaller, productivity-oriented Java language features,? the original poster?s choice of amber-dev was reasonable. - Mark [1] https://mail.openjdk.org/mailman/listinfo/discuss [2] https://openjdk.org/guide/#area-mailing-lists [3] https://openjdk.org/projects/amber/ From davidalayachew at gmail.com Mon Oct 23 21:03:26 2023 From: davidalayachew at gmail.com (David Alayachew) Date: Mon, 23 Oct 2023 17:03:26 -0400 Subject: Is there a possibility of the string equality operator (==) being fixed? In-Reply-To: <20231023114945.393941906@eggemoggin.niobe.net> References: <20231023114945.393941906@eggemoggin.niobe.net> Message-ID: Ok. Thanks for the heads up. On Mon, Oct 23, 2023 at 11:49?AM Mark Reinhold wrote: > 2023/10/22 15:29:58 -0400, David Alayachew : > > Hello, > > > > Thank you for reaching out! > > > > I'm pretty sure that the amber-dev mailing list is not the correct place > > for this type of question. This topic usually goes on at the following > > mailing list instead. I've CC'd it for you. I would also encourage you to > > remove amber-dev from your CC when responding to me, or anyone else on > this > > thread. > > > > discuss at openjdk.org > > In fact, the discuss list is not appropriate for this type of question. > Per the list?s description [1]: > > This list is for general discussion about the OpenJDK Community, > including proposals of new Projects and Groups. > > This is not a place to discuss specific technical proposals. For that, > please use an appropriate area-specific mailing list. > > This is not a place to ask support questions. Please direct those to > whoever provided your JDK build. > > The OpenJDK Developers? Guide includes a list of area-specific mailing > lists [2], but there isn?t a list specifically for the Java programming > language. Given that the charter of Project Amber [3] is to ?explore > and incubate smaller, productivity-oriented Java language features,? > the original poster?s choice of amber-dev was reasonable. > > - Mark > > > [1] https://mail.openjdk.org/mailman/listinfo/discuss > [2] https://openjdk.org/guide/#area-mailing-lists > [3] https://openjdk.org/projects/amber/ -------------- next part -------------- An HTML attachment was scrubbed... URL: