How would you ensure identity? Do a search on every Symbol creation? Keep a=
 hash map?

On Oct 3, 2011, at 09:41 , Kurt Stephens wrote:

>=20
> Issue #5392 has been reported by Kurt  Stephens.
>=20
> ----------------------------------------
> Feature #5392: Symbol GC
> http://redmine.ruby-lang.org/issues/5392
>=20
> Author: Kurt  Stephens
> Status: Open
> Priority: Normal
> Assignee:=20
> Category:=20
> Target version:=20
>=20
>=20
> I looked more into Symbol GC.  The biggest problem is IDs are not VALUEs.=
  My outburst at RubyConf based on my stupid assumption that they were -- I=
 was trying to attack the problem using WeakRefs.
>=20
> If IDs were VALUEs and Symbols were allocated like any other Object, the =
existing GC mark and root machinery (including C stack root scans), would t=
ake care of it, with an additional sweep of the global_symbol lookup tables=
.
>=20
> However, the remaining issue is IDs stored in globals.  No matter what, I=
Ds stored in C globals will need to be rb_gc_register_address(VALUE*) roots=
 -- this means CRuby API/contract changes.
>=20
> Adding a standalone ID mark table and a rb_gc_mark_id() function will not=
 fix problem of lone IDs on the C stack.
>=20
> What was the original reason to distinguish Symbol IDs from Object VALUEs=
, besides making lexer tokens simple to map.
> Would changing IDs to be allocated VALUE objects simplify internals anywa=
y?  This change could also allow Anonymous Symbols and Anonymous Methods.
>=20
> -- Kurt Stephens
>=20
>=20
>=20
>=20
> --=20
> http://redmine.ruby-lang.org
>=20