Ike,

in Java:

String a = "Hello";
String b = new String("Hello");
boolean notSame = a == b; // false, the object references are not the same

String a = "Hello".intern();
String b = (new String("Hello")).intern();
boolean same = a == b; // true, the object references are the same

Intern and Symbol do something very similar.  They convert the string
to an Object that has the same object reference.

However, in Ruby, symbols are much faster and more efficient than in
Java.  Ruby uses an internal hash to store the symbols and the lookup
is very, very fast.  Ruby uses symbols internally for method lookup
and dispatch.  In Java, as far as I can tell, the .intern() method is
an O(n) where n is the number of Strings that have been intern()ed.

Does this help?

On 7/28/06, Ike <rxv / hotmail.com> wrote:
> does the colon operator have an anolog in say, Java or C++ ? It seems to be
> a reference pointer. Am i mistaken in assuming this? Thanks, Ike
>
>
>
>


-- 
--------
David Pollak's Ruby Playground
http://dppruby.com