Click here to Skip to main content
15,880,608 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Language + ? = BFF Pin
jmaida2-Dec-22 10:16
jmaida2-Dec-22 10:16 
GeneralRe: Language + ? = BFF Pin
OriginalGriff2-Dec-22 8:42
mveOriginalGriff2-Dec-22 8:42 
GeneralRe: Language + ? = BFF Pin
PIEBALDconsult2-Dec-22 8:55
mvePIEBALDconsult2-Dec-22 8:55 
GeneralRe: Language + ? = BFF Pin
OriginalGriff2-Dec-22 10:22
mveOriginalGriff2-Dec-22 10:22 
GeneralRe: Language + ? = BFF Pin
PIEBALDconsult2-Dec-22 10:59
mvePIEBALDconsult2-Dec-22 10:59 
GeneralRe: Language + ? = BFF Pin
jschell5-Dec-22 6:27
jschell5-Dec-22 6:27 
GeneralRe: Language + ? = BFF Pin
PIEBALDconsult5-Dec-22 6:45
mvePIEBALDconsult5-Dec-22 6:45 
GeneralRe: Language + ? = BFF Pin
jschell12-Dec-22 10:13
jschell12-Dec-22 10:13 
PIEBALDconsult wrote:
Then explain how StringBuilder works.


Huh? Because it is a different class of course.

Other than that I suggest you look at the Java API source code, which I have. You will find that StringBuilder is entirely written in Java.

PIEBALDconsult wrote:
"why did they choose to implement the VM that way?"


Strings are intrinsic part of modern programming languages. That was known before java was created.

Other than that I can only guess that given that the the class file itself would have needed some kind of unique identifier regardless of how it was implemented. So using a String value for that perhaps was just convenient.

PIEBALDconsult wrote:
is hitting the issue with too big a hammer.


Yes but that isn't the point. The type 'String' is part of the VM definition. It is not well defined in the specification. For that matter the entirety of the VM/Java specification is not very well done. It still has errors in it today which have existed since the very first version. (For examples of well done specifications look to the ANSI C and C++ specifications.)

But even if it had been better specified it would have been "very short-sighted" to allow it to be mutable.

PIEBALDconsult wrote:
that a string value will be mutable until it is set to immutable


At a minimum that would have required at least one and perhaps several features in the Java Spec and VM Spec. I am not even sure it would be possible. I say that because consider how one can access private data members via JNI or even reflection. Certainly with my understanding of security matters I would say that I would not like to see accessing it that way. (I note that I suspect it is possible to hack a C/JNI solution that would allow one to make a String mutable, but it would be VM version dependent and would require an extreme amount of spelunking and would be very difficult to change the length of the string versus just characters in the string.)
GeneralRe: Language + ? = BFF Pin
Single Step Debugger2-Dec-22 9:23
Single Step Debugger2-Dec-22 9:23 
GeneralRe: Language + ? = BFF Pin
PIEBALDconsult2-Dec-22 9:29
mvePIEBALDconsult2-Dec-22 9:29 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger2-Dec-22 9:36
Single Step Debugger2-Dec-22 9:36 
GeneralRe: Language + ? = BFF Pin
PIEBALDconsult2-Dec-22 9:39
mvePIEBALDconsult2-Dec-22 9:39 
GeneralRe: Language + ? = BFF Pin
David O'Neil2-Dec-22 9:37
professionalDavid O'Neil2-Dec-22 9:37 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger2-Dec-22 10:09
Single Step Debugger2-Dec-22 10:09 
GeneralRe: Language + ? = BFF Pin
David O'Neil2-Dec-22 10:20
professionalDavid O'Neil2-Dec-22 10:20 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger2-Dec-22 10:24
Single Step Debugger2-Dec-22 10:24 
GeneralRe: Language + ? = BFF Pin
David O'Neil2-Dec-22 10:30
professionalDavid O'Neil2-Dec-22 10:30 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger5-Dec-22 2:53
Single Step Debugger5-Dec-22 2:53 
GeneralRe: Language + ? = BFF Pin
David O'Neil5-Dec-22 6:41
professionalDavid O'Neil5-Dec-22 6:41 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger5-Dec-22 8:22
Single Step Debugger5-Dec-22 8:22 
GeneralRe: Language + ? = BFF Pin
David O'Neil5-Dec-22 9:25
professionalDavid O'Neil5-Dec-22 9:25 
GeneralRe: Language + ? = BFF Pin
Gary R. Wheeler2-Dec-22 10:01
Gary R. Wheeler2-Dec-22 10:01 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger2-Dec-22 10:20
Single Step Debugger2-Dec-22 10:20 
GeneralRe: Language + ? = BFF Pin
0x01AA2-Dec-22 11:05
mve0x01AA2-Dec-22 11:05 
GeneralRe: Language + ? = BFF Pin
Single Step Debugger5-Dec-22 2:56
Single Step Debugger5-Dec-22 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.