On 12/21/2010 3:01 PM, Pavel Rosputko wrote:
> Propose:
> 5.times { %c(asdasdf).object_id } ->  same!
>
> Example of usefullness:
>
> a,b,c,d = data.unpack %c(ccNc) |
> e,f,g,h = a.unpack %c(cvaN)    |  repeated many times
>
> Aspects:
>   - String like 'ccNc' are created many times
>   - Not modified
>   - Used once in code
>
> It is possible to write "class K; Format_ccNc = 'ccNc'; end"
> but Format_ccNc will be used only once!
>
> It is logical to make %c() strings frozen.

If this happens, and %c() is indeed frozen / immutable, then we should 
also have these objects pooled globally (the way Java handles literals), 
not just per-occurrence, eg.:

     x = %c(Foo bar)
     # ... somewhere else in the code ...
     y = %c(Foo bar)
     assert_equal x.object_id, y.object_id

- Loren