How about something more generic? A prefix operator that memoizes and freezes any expression result in a thread-safe manner on first eval: %f'a frozen string' # %f"a frozen #{interpolated} string" # %f{a: '...kstephens (Kurt Stephens)
marcandre (Marc-Andre Lafortune) wrote: > So it's probably only MRI that does stuff like `rb_funcall(obj, '>', 1, INT2FIX(0))` That can be changed to: #define CHAR2SYM(X) _rb_char_symbol_table[X] rb_funcall(obj, CHAR2SYM('>...kstephens (Kurt Stephens)
marcandre (Marc-Andre Lafortune) wrote: > kstephens (Kurt Stephens) wrote: > ... Yup. That's an assumption I can't fix. Unless we have a class of VALUES < 127 that are immediate single-ASCII character Symbols, and we cant do that be...kstephens (Kurt Stephens)
Student (Nathan Zook) wrote: > Questions: > ... With the unit and functional tests that already exist. What cases do you have in mind? > 2) In order to actually recover the memory, the symbol table has to be walked each time a sym...kstephens (Kurt Stephens)
Mark and sweep the symbol table like any other GC heap. However there are some issues in the C API. IDs in the C API are distinct from other values and Ruby extensions expected them to be pinned (never GCd). Therefore, the C API must s...kstephens (Kurt Stephens)
How would it behave for immediate VALUEs (Fixnum, Symbol, etc.)? Or value classes that are immutable or often occur as literals (Float, Rational, Time, etc.)? This would probably be very difficult to implement in JRuby (and other Rub...kstephens (Kurt Stephens)
Marc-Andre Lafortune wrote: > Shyouhei Urabe wrote: > ... See https://github.com/kstephens/red_steak/blob/master/lib/red_steak/copier.rb The problem is how to control how "deep" a copier should go, which objects need to have identit...kstephens (Kurt Stephens)
On 16/02/2012, at 12:28 PM, Charles Oliver Nutter wrote: > ... someone might rely on the same symbol having > ... The only "safe" object_id is a monotonic one that is not tied to a memory address; by definition, a collector will reus...kstephens (Kurt Stephens)