From: Yehuda Katz Date: 2009-02-26T06:15:07+09:00 Subject: [ruby-core:22508] Re: YASNP (Yet Another Selector Namespace Proposal) --000e0cd2e61ca1d9720463c4bd61 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I addressed some of this in the original proposal. Using a namespace would modify the call node (or instruction) to include a list of the namespaces included, which would then be looked up when methods were looked up. This could also be cached (the selector name and the list of namespaces). -- Yehuda 2009/2/25 Ola Bini > Jim Weirich wrote: > >> >> On Feb 25, 2009, at 2:08 PM, Ola Bini wrote: >> >> - How would this interact with send? >>> - How would it interact with other introspection facilities? >>> Kernel#method ? >>> Basically, what is the runtime behavior of all metaprogramming and >>> introspection features here... >>> - Do I understand correctly that this is supposed to be a lexical effect, >>> and not a dynamic one? >>> >> >> Ola asks some great questions. I have a few as well: >> >> (1) If two selector namespaces are in scope, and they both define a method >> of the same name, which one takes precedence? (i.e. Assume that namespaces >> X and Y both defined a method "to_xml" on Object, and that both are in >> scope. Which version will be invoked?) >> >> (2) With a particular namespace in scope, will there be a way to >> explicitly invoke a conflicting method from a different namespace (i.e. >> Assume that namespaces X and Y both define a method "to_xml" on Object. >> Will there be a way to explicitly invoke the Y version of "to_xml" from >> code that is currently in the scope of the X namespace.) >> >> Good questions. At this point I'm getting confused about terminology. > > We have all been using the words "namespace" and "selector" pretty much > interchangeably in this thread. > I'm becoming a bit confused about talking about several selectors being in > scope at the same time here. One of my points in the other mail I sent was > that there is no real way to know what a namespace contains until runtime - > and the parser needs to know at parse time - otherwise it can't choose the > right namespace. Which is why I thought there could only be _one_ namespace > active at the same time. > > For more reference, I urge a look at Common Lisp packages. > > Cheers > > -- > Ola Bini (http://olabini.com) Ioke creator (http://ioke.org) > JRuby Core Developer (http://jruby.org) > Developer, ThoughtWorks Studios (http://studios.thoughtworks.com) > Practical JRuby on Rails (http://apress.com/book/view/9781590598818) > > "Yields falsehood when quined" yields falsehood when quined. > > > > -- Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 --000e0cd2e61ca1d9720463c4bd61 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I addressed some of this in the original proposal. Using a namespace would = modify the call node (or instruction) to include a list of the namespaces i= ncluded, which would then be looked up when methods were looked up. This co= uld also be cached (the selector name and the list of namespaces).

-- Yehuda

2009/2/25 Ola Bini <ola.bini@gmail.com&= gt;
Jim Weirich wrote:

On Feb 25, 2009, at 2:08 PM, Ola Bini wrote:

- How would this interact with send?
- How would it interact with other introspection facilities? Kernel#method = ?
=A0 Basically, what is the runtime behavior of all metaprogramming and int= rospection features here...
- Do I understand correctly that this is supposed to be a lexical effect, a= nd not a dynamic one?

Ola asks some great questions. =A0I have a few as well:

(1) If two selector namespaces are in scope, and they both define a method = of the same name, which one takes precedence? =A0(i.e. Assume that namespac= es X and Y both defined a method "to_xml" on Object, and that bot= h are in scope. =A0Which version will be invoked?)

(2) With a particular namespace in scope, will there be a way to explicitly= invoke a conflicting method from a different namespace (i.e. Assume that n= amespaces X and Y both define a method "to_xml" on Object. =A0Wil= l there be a way to explicitly invoke the Y version of "to_xml" f= rom code that is currently in the scope of the X namespace.)

Good questions. At this point I'm getting confused about terminology.
We have all been using the words "namespace" and "selector&q= uot; pretty much interchangeably in this thread.
I'm becoming a bit confused about talking about several selectors being= in scope at the same time here. One of my points in the other mail I sent = was that there is no real way to know what a namespace contains until runti= me - and the parser needs to know at parse time - otherwise it can't ch= oose the right namespace. Which is why I thought there could only be _one_ = namespace active at the same time.

For more reference, I urge a look at Common Lisp packages.

Cheers

--
Ola Bini (http://olabini.c= om) Ioke creator (http://= ioke.org)
JRuby Core Developer (http:/= /jruby.org)
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)

"Yields falsehood when quined" yields falsehood when quined.






--
Yehuda Katz
D= eveloper | Engine Yard
(ph) 718.877.1325
--000e0cd2e61ca1d9720463c4bd61--