Charles Oliver Nutter <headius / headius.com> wrote:
> On Wed, Jun 8, 2011 at 4:00 PM, Eric Wong <normalperson / yhbt.net> wrote:
> > Charles Nutter <headius / headius.com> wrote:
> >> What's the effect of the EPHEMERAL flag if someone takes an object
> >> with an attached ephemeral class and starts making singleton changes
> >> to that object? Do those changes properly flush cache?

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...

> > No, it's a situation where the user must be careful and not shoot
> > themselves in the foot. ??It is C, after all.

...the the /only/ safe way to use RCLASS_EPHEMERAL is before any methods
are called (and cached) for the singleton class.

> But isn't this an exception object that will be raised into Ruby code?
> In other words...
> 
> 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.