--001636e0a64a68cb3a04634ac638 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2009/2/19 Florian Gilcher <flo / andersground.net> > > On Feb 19, 2009, at 8:15 AM, Charles Oliver Nutter wrote: > > Charles Oliver Nutter wrote: >> >>> Caveats: >>> * HACKHACKHACK >>> * Only works for single-arg "call" in this case, but easy to generalize >>> to all other calls >>> * The namespace never gets turned off in this example. It wouldn't be >>> hard to add with parser help, but there's no trigger I can use in this >>> simple version. >>> * Interpreter-only. Compilation would be a bit trickier, but not much. >>> >> >> Another important one: >> >> * This version searches the namespace for the method *unconditionally*. It >> would probably be desirable to identify whether it applies to the receiver >> or not: >> >> use String Merb::String >> >> And then the namespace association only applies when the receiver is_a? >> String. >> >> - Charlie >> >> > > That sounds a lot like the Objective-C method poseAs, discarding some of > it's limitations. > > But what is the scope of use? AFAIK, there is no construct in Ruby that has > a file-only scope (except the ones that need to be closed because of > syntactical reasons). Granted, those are details. I would be open to making it take a block, but I'm not aware of any use-case where that would be helpful, so I left it out at the beginning to reduce the need for extra ceremony. > > > But what about this example in Yehudas gist: > >