On Thu, Jun 9, 2011 at 3:17 AM, Eric Wong <normalperson / yhbt.net> wrote:
> Nevermind, I misread the first time and got ordering of your question
> mixed up in my mind.
>
> Once a class is tagged RCLASS_EPHEMERAL, it's impossible for it to
> write to the cache. There's no need to flush the cache for ephemeral
> classes because...
...
> ...the the /only/ safe way to use RCLASS_EPHEMERAL is before any methods
> are called (and cached) for the singleton class.

>> begin
>>  io.read_nonblock
>> rescue WaitReadable => e
>>  class << self
>>   # add something cute
>
> Any methods defined here will never be cached, because RCLASS_EPHEMERAL
> was set before we re-entered Ruby-land.

Ok, not being familiar with the MRI code, and not seeing more than a
few lines of context in the patch, I didn't get this.

So summarizing in non-code:

* Ephemeral class creation does not flush global cache
* ...because ephemeral class methods will never be cached

But I'm confused; if code has already cached a method from an
ephemeral class's superclass, and someone adds to the ephemeral class,
does the new method get picked up? Hopefully adding methods to an
ephemeral class still clears cache, because otherwise invocation won't
see such changes. Am I following?

I need to look at ko1's patch since that seems to please you.

- Charlie