Robert Klemme wrote in post #1102581:
> On Thu, Mar 21, 2013 at 11:31 AM, Marcin R. <lists / ruby-forum.com>
> wrote:

>> Ok, I solved this. My description was rather clumsy, but code speaks
>> more than thousand words.
>
> I usually prefer a written explanation of the purpose of the code.
> The code is the solution but the goal does not always become apparent
> from looking at code.
>

So true, but I am hoping my explanation given below was sufficient.

>> This block gives user the ability to write method like
>> this:
>>
>> chain_method :hello
>> def hello
>>   p "Hello"
>>   yield
>> end
>
> Why would I want to do that?  What is that supposed to do?
>

As I mentioned previously my goal is to create easy to use 
implementation of chain pattern. You can do it manually, calling 
next-in-line via some sort of reference you keep ("next" in my case), 
but I feel that we can do better than this. My idea is to keep 
boilerplate in chain module and let implementations yield (because 
that's quite natural way of doing things like this in Ruby - you 
temporarily yield control to regain it later) when they need to pass the 
control down the chain.

>> If call is recursive than it is either 'super' call or plain recursion,
>
> Super call is not recursion.  Recursion is when a method invokes
> itself.  Super calls are used to augment a super class's
> implementation of a method with additional logic specific to the
> derived class.
>

Yes, so I said - EITHER super OR recursive.

>> we don't care which one it is. In this case we're binding method
>> reference that is accessible from closure we're in to self and call it
>> via #call, thus bypassing polymorphic call that caused troubles in the
>> first place. Makes sense? I'll be happy to hear your take on this.
>
> I still don't understand what you are up to and what your ultimate goal
> is.
>

Hope I've already made myself clear. Thanks for your input.

-- 
Posted via http://www.ruby-forum.com/.