W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > May 2011

Re: Spira: method resolution of has_many resources not working sometimes

From: Christoph Badura <bad@bsd.de>
Date: Fri, 20 May 2011 22:12:48 +0200
To: Ben Lavender <ben@dydra.com>
Cc: public-rdf-ruby@w3.org
Message-ID: <20110520201248.GB8151@irregular-apocalypse.k.bsd.de>
On Fri, May 20, 2011 at 12:11:10PM -0500, Ben Lavender wrote:
> This is a quirk of Promise. In Ruby 1.8, there is no BasicObject, so
> Promise fakes it by undefining all of the non-critical methods on
> Object. When you monkey-patch Object to have a to_zorch, Promise does
> not pass the method through to the underlying promised thunk, and you
> get Object's version. In Ruby 1.9 (which I tested, which is why I did
> not see the same behavior), Promise uses BasicObject, which did not
> get #to_zorch added to it by adding it to Object. I do not imagine
> this behavior would happen in any case other than monkey-patching
> Object itself.

OK. Thanks for the explanation.  I was already wondering if this was
different in 1.9.

I discovered this because Rails monkey-patches Object with e.g. to_param
which is kinda important. 

I guess another workaround is to removed the methods that Rails monkey-patches
into Object from Promise.

It would be nice if that behaviour of promise were documented.

Received on Friday, 20 May 2011 20:13:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:53:41 UTC