From: Austin Ziegler Date: 2006-07-05T06:32:48+09:00 Subject: Re: About 1.9 #__method__ feature. On 7/4/06, Yukihiro Matsumoto wrote: > Me: >> Will #funcall be the way that I can circumvent private? > obj.foo(5) # Throws an error, just as now. > obj.send(:foo, 5) # Throws an error, it's private. > obj.funcall(:foo, 5) # Success. funcall can call private. 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 I'm not sure. I do think that #implicit_send is better than #funcall, and maybe #explicit_send is better than #send. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca