From: Pit Capitain Date: 2001-09-22T15:04:08+09:00 Subject: [ruby-talk:21519] Re: Replacement for __FILE__ == $0 Nathaniel Talbott: > OK, this will probably end up being an RCR, but first I want to get > some feedback. Does this construct bother anybody else?: > > if __FILE__ == $0 > ... Do stuff ... > end Yes, it does. Kevin Smith: > I am always reluctant to add new keywords or methods to > core classes. Me too. > Adding in_main_file increases the total complexity of Ruby, > which is already a bit more complex than I would like. Just > my own preference. Agreed. But this should not be an excuse to not provide means for writing code that's simpler to read. We could try to build a library as a first step, something like (naming to be discussed) require 'mainfile' in_main_file { ... } Those who are bothered by the current implementation (as I am) could use the library, the others don't have to. Pit