From: Brent Roman Date: 2009-02-26T03:08:46+09:00 Subject: [ruby-core:22476] Re: YASNP (Yet Another Selector Namespace Proposal) At least regarding blocks vs. a special keyword: There may be a middle way If the parser were modified such that upon encountering the EOF token, it terminated the current do/end block, then :use could be a normal Kernel method that simply takes block, without introducing spurious indentation. use MyWorld do .... This also allows quite handy expressions such as: ruby -e "3.times do print 'Howdy, '" or eval "3.times do print 'Howdy, '" There is still the question of whether EOF should terminate nested do style blocks in order to handle: use MyWorld do use OtherWorld do ..... This parser change certainly is easy to implement. And, it cannot break any working code. - brent Charles Oliver Nutter-2 wrote: > > Yukihiro Matsumoto wrote: >> +1 to have some kind of selector namespace (it's planned for 2.0 >> anyway), but -1 for using block (or block-like syntax) to denote >> namespace scope, because >> >> * it's not really a block >> * too small granularity for namespace switching might bring confusion >> >> I'd prefer per file namespace switching. > > I think it's impossible to have per-file without making "use" a special > keyword, ideally at the top of the file. The block syntax made more > sense to me because I knew exactly when it started and ended, and a > 'use' later in the file did not affect code that came before it. Also, > the example where I have both a namespace and a 'use' in the same file > would be impossible if the use applied to the whole file. > > I'm willing to mock up anything else we want to try, including a > whole-file version. > > - Charlie > > > -- View this message in context: http://www.nabble.com/-ruby-core%3A22246--YASNP-%28Yet-Another-Selector-Namespace-Proposal%29-tp22094654p22208463.html Sent from the ruby-core mailing list archive at Nabble.com.