James Britt schrieb:
> If you change the behavior of NilClass (e.g., NilClass.blackhole = true) 
> it is changed for all nil occurrences (nil is a singleton object, so 
> there is only one instance).
> 
> If there are multiple threads running, and one of them decides NilClass 
> should swallow all unknown methods (even if only during the execution of 
> a specific block) then all processes will see the same behavior until 
> some code sets NilClass.blackhole = false.

I don't know whether this would be useful, but you can use thread-local 
variables [1] to make this behavior dependent on the current thread. I 
can send you the code, if you like.

Constraining this behavior to a specific block is more interesting. Do 
you think of lexical or dynamic scope? (With "lexical scope" I mean only 
the code in a given block, whereas "dynamic scope" would be the code in 
the block plus all methods called from there.)

Regards,
Pit

[1] http://www.ruby-doc.org/core/classes/Thread.html#M001024