On Mon, 2011-08-29 at 14:16 +0200, Daniel Schierbeck wrote: > @Jon: I could change the implementation to check `args.length` and > raise ArgumentError if the result is greater than 1. But wouldn't it > suffice to simply define the writer methods with only one argument?
Yes, that's what I meant. We need a patch against 3-1-stable that: * Calls @target.foo, rescues NoMethodError, tries @target.__send__(:foo) and if that works, shows a deprecation warning. (The reason for this implementation is that there should be no performance hit in the public case.) * Shows a deprecation warning if args.length > 1 && method_name.ends_with?('=') Then, we need the patch against master to just define def foo=(bar) (no splat), when method_name.ends_with?('='). If the deprecation in 3-1-stable is too involved, we might need to think about deprecating in 3.2 and removing in 3.3. But let's see the code first. Also note that this deprecation won't get into 3.1.0, so it would be a new deprecation in 3.1.1. (Some may object to this, but I think it's acceptable personally.) > @Xavier: I think users perceive `delegate` as a shorthand for: > > def foo > @target.foo > end > > and not > > def foo > @target.__send__(:foo) > end > > so I actually believe the proposed semantics more closely resembles > the perception. That's just my point of view, of course. Yes, this is my perspective as well. To me the POLS is that 'delegate' is a macro for the former, which does not support non-public methods. -- http://jonathanleighton.com/
signature.asc
Description: This is a digitally signed message part