From: Richard Kilmer Date: 2004-06-09T03:40:56+09:00 Subject: Re: Expressing intent in method calling... On 6/8/04 12:11 PM, "Jeff Mitchell" wrote: > > --- Dave Thomas wrote: >>> class Person >>> attr_accessor :name >>> end >>> >>> def greet(person) >>> puts "Hello there #{person.name}" >>> end >> >> Isn't this effectively "to_name" or "as_name"? > > Whether it's name or to_name, he is seeking a way to differentiate > person names and Nonlinear Altitude Modulation Expositors. > > To use an example from your book, he wants to distinguish > between Action#sin and Trig#sin. He can "let it ride" and see > what happens by just calling #sin, but I think the motivation > behind these threads is to provide support for methods/interfaces > which claim some conformant behavior. > Well, not necessarily conformant behavior. Its so the caller can express what they are expecting the behavior to be, and receiver then making use of that or not. I am not 'casting' the receiver to a Person nor asking the runtime to check to ensure that it is a Person, I am allowing the receiver to understand something of what I want it to do beyond a simple symbol/param list...instead its a namespaced symbol/param list, which may disambiguate the request. The receiver can check on the supplied namespace (if present) and act accordingly. I guess the reason for this is we already have namespaces (modules/classes) and methods in them...there is just no way to use the namespaces to add meaning to a method requests. -rich