From: transfire@... Date: 2006-07-05T21:21:03+09:00 Subject: Re: About 1.9 #__method__ feature. Austin Ziegler wrote: > Okay. Next: what will the non-overridable versions of these methods be? > Will I have to do > > Object.method(:send).bind(obj).call(:foo, 5) > > or will there be an equivalent to #__send__ still? Will #object_id be > overridable? I would prefer to have a simple, clear way that *cannot be > overridden* to get at these values which, for readability purposes, can > or should be overridden. (#send is a particularly nasty example, since > Mail#send would be appropriate. ;) > > I am not a fan of #funcall -- yes, it's called without an explicit > receiver, but it *is* called with an implicit receiver. Given that this > is the case, I think that the #send/#send! dichotomy is not appropriate. > > Trans had a suggestion that I've chewed on for a while and think might > be worthwhile considering for this sort of thing. Perhaps we need these > sorts of methods to be external to classes, say Meta: > > Meta.object_id(obj) > Meta.send(obj, :foo, 5) # fails on private > Meta.implicit_send(obj, :foo, 5) # succeeds on private It does seem appropriate that introspection be handled externally. I sort like the idea of global functions: $object_id(obj) $send(obj, :foo, 5) $funcall(obj, :foo, 5) That certianly makes it clear one is in the meta programming realm. But do we need to go so far? Well, I think something is in order. As it is the meta programmer is roughing it, with things like you're binding example. When meta programming it's important to have garunteed way to get the object_id and other such information about an object. It's also important to be able to bypass method privacy. So what if we followed a simple rule that all methods starting with #object_ or #instance_ were not overridable? And we could add #object_send and #instance_send. The former always routes to the Object binding and the later bypasses privacy. With a few other adjustments (eg. object_class, object_tainted?, etc.) I think that would be an effective and straight foward solution. T.