From: gwtmp01@... Date: 2005-06-27T05:58:47+09:00 Subject: Re: Defining a method vs aliasing it On Jun 26, 2005, at 3:56 PM, David A. Black wrote: >> Maybe I'm missing something (probably) but there seems to be a >> semantic >> mismatch between the word 'alias' and the behavior of the method >> 'alias'. >> >> Shouldn't it be called dup_method or something similar? > > I believe it's the other way around: aliasing a method name just adds > another name for the same method. If you then redefine the original > method, the two names then point to different methods: Like I said, I was probably missing something. What I was missing was a correct understanding of how method redefinition occurs. I was thinking of method redefinition as an operation applied to the *existing* method body. Sort of like changing the contents of a string. The change is "visible" to anybody holding a reference to the string. If I'm understanding correctly now, during method redefinition Ruby constructs a brand new method body and then binds it to the existing name thus breaking the binding made by the previous definition. If there are multiple bindings to the same method body (via alias) then those old bindings still have access to the original method body. Thanks for the clarification. Gary Wright