Re: Comparsions of String objects with == produces incorrect result

Patrick Niemeyer <[email protected]> Sun, 31 Oct 2004 21:49:34 -0600
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
On Oct 30, 2004, at 1:50 AM, Ulrich Grude wrote:

> The "Java Lang. Spec.", 2nd edition, says in chapter 3, verse 10.5: "A 
> string literal always refers to the same instance (ยง4.3.1) of class 
> String". I understand this as "interning is mandatory", but I may be 
> mistaken.

What is the scope of that... within a class?  Or within classes 
compiled at the same time?

> In general, interning is a rather obscure optimization feature and 
> maybe is not worth the trouble to be included into the BeanShell. On 
> the other hand: It would be nice to have even less semantic 
> differences between the BeanShell and the compiler/interpreter by Sun  
> (as a teacher I would have to do less teaching :-).

It's a one line change in BSHLiteral... just want to make sure it is 
correct and doesn't impact performance negatively...  I can't see any 
reason not to do it otherwise.


Thanks,
Pat


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click