From: Charles Oliver Nutter Date: 2009-02-26T06:44:18+09:00 Subject: [ruby-core:22518] Re: YASNP (Yet Another Selector Namespace Proposal) Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:22490] Re: YASNP (Yet Another Selector Namespace Proposal)" > on Thu, 26 Feb 2009 04:08:19 +0900, Ola Bini writes: > > |If any of this has been answered, or if I misunderstood something, I > |apologize in advance: > > Here's MY opinion. > > |- How would this interact with send? > > send should honor namespaces. Very difficult. Perhaps we're thinking about namespaces differently? For me, namespaces are simply hooking the call process to provide a different method lookup channel. The fact that they're attached to a given type is largely unrelated. And namespaces as described would not affect downstream "secondary calls", so you couldn't namespace "each" and have "map" honor that change. I consider "send"'s eventual call of the target method to be a similar "secondary call". Of course the namespace proposal could be modified to be bound to a specific type or to affect downstream calls, but those are much larger changes. > |- How would it interact with other introspection facilities? Kernel#method ? > | Basically, what is the runtime behavior of all metaprogramming and > |introspection features here... > > and other introspection features as well. Same reasons as above; if namespaces are just a call-protocol hook, their effect on a given type is irrelevant for introspection purposes. Yes, I may be namespacing calls to String#to_s to do something different. But String doesn't suddenly define different methods as a result. > One possible idea is making symbols to belong to each namespace, like > Common Lisp does, in that case, > > obj.foo(bar) > > should be work as > > obj.(bar) > > where means "symbol foo in that namespace", and its > correspondence can be modified by (dynamic) method definitions. This is probably fine, so long as we don't go down the path of having to reevaluate the namespace every time we want to make a namespaced call. That would make it prohibitively expensive. - Charlie