[Nitro] Facets symbol.to_s problem
transfire at gmail.com
transfire at gmail.com
Thu Feb 1 15:14:45 EST 2007
On Feb 1, 2:08 pm, "nya... at gmail.com" <nya... at gmail.com> wrote:
> On Feb 1, 1:58 am, "George Moschovitis" <george.moschovi... at gmail.com>
> wrote:
>
> > Tom,
>
> > facets/core/symbol/to_s freezes the generated string, causing a lot of
> > problems in Og, in code like:
>
> > acc << symbol.to_s
> > acc << "..." if ...
>
> > can you please remove the .freeze ? There is a workaround of course
> > "#{symbol}" but it looks uggly!
>
> Why do you need a facet for this? At least as of Ruby 1.8.5:
class Symbol
# Same functionality as before, just a touch more efficient.
def to_s
@to_s || (@to_s = id2name)
end
end
Not sure why it was being frozen. (Although some people have suggested
getting rid of symbols in RUby 2.0 and replacing them with frozen
strings)
T.
More information about the Nitro-general
mailing list