News for hackers. Stuff that matters.
Re:Oracle Tunes Java's Internal String Representation by PaulHoule on Wednesday December 25, 2013 @11:43AM (#6963346)
I dunno, can you build a special kind of CharSequence which works like the old String did?
Re:Oracle Tunes Java's Internal String Representation by twic on Wednesday December 25, 2013 @12:46PM (#6963587)
Speaking of CharSequence, one sneaky and bizarre option would be to make String's implementation of CharSequence::subSequence work the old way. subSequence returns a CharSequence, not a String, so it is free to return some specialised object which specifically represents a substring rather than a first-class string. Rather like slices in go, which would win Java some trendiness points.

This would be a surprising bit of behaviour, which means it's probably a bad idea. However, it wouldn't break any current code, because it preserves current behaviour, and hopefully wouldn't break future code, because people could learn about the quirk. Also, i think subSequence tends to be used to create temporary objects as computational intermediaries, rather than new long-lived objects which escape to the heap, so it shouldn't lead to excessive packratting in the way the old-style substring did.

Re:Oracle Tunes Java's Internal String Representation by twic on Wednesday December 25, 2013 @07:23PM (#6964807)
Okay, so of course they considered this, and decided it was a bad move:

http://www.reddit.com/r/programming/comments/1qw73v/til_orac...