[ruby-core:102330] eliminating symbols...
From:
Eric Wong <normalperson@...>
Date:
2021-01-31 01:13:13 UTC
List:
ruby-core #102330
Was just catching up with some of the HashWithIndifferentAccess discussion at
https://bugs.ruby-lang.org/issues/17472
Could a magic comment (e.g. "# symbols_are_strings: true")
make :foo a shorthand for a frozen 'foo' String?
If you turn your head sideways, the : character can look like ''
That would provide a migration path which would allow reducing
the use of Symbols and maybe get rid of it down-the-line(*).
Implementation-wise, every symbol already has a frozen string
associated with it, so there's no extra memory cost.
(*) I now consider Symbols a mistake of the Ruby language design
and they should've been only an implementation detail. This
is even more so with GC-able symbols nowadays. But maybe my
brain is infected by too much Perl5 :P
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>