Is there a possibility of the string equality operator (==) being fixed?
tzengshinfu
tzengshinfu at gmail.com
Sun Oct 22 15:52:40 UTC 2023
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: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20231022/2e036167/attachment.htm>
More information about the amber-dev
mailing list