Hi,

In message "Re: Literal inconsistency"
    on Mon, 4 Sep 2006 22:54:36 +0900, Calamitas <calamitates / gmail.com> writes:

|This surprised me today:
|
|  irb(main):014:0> 2.times { puts "hello".object_id }
|  -606413918
|  -606413938
|  => 2
|  irb(main):015:0> 2.times { puts /hello/.object_id }
|  -606420168
|  -606420168
|  => 2
|
|The regexp could be compiled once while parsing and a new Regexp
|object could be created on each execution with a speed hit comparable
|to string literals (which I suppose is acceptable.)

Since Ruby strings are mutable, string literals creates new string
objects each time.

							matz.