From: Nathaniel Talbott Date: 2001-09-22T09:41:25+09:00 Subject: [ruby-talk:21512] Re: Replacement for __FILE__ == $0 Kevin Smith [mailto:kevinbsmith@yahoo.com] wrote: > --- Nathaniel Talbott wrote: > > 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 > > The __FILE__ part doesn't bother me, but the $0 does. How > about just creating an alias for $0? It's the main file, > right? so __MAINFILE__ or $MAIN_FILE or something like that > seems reasonable. I think *ALL* the cryptic perl leftovers > should have friendly aliases, and most already do. > > I don't really like the idea of creating a wrapper for the > entire expression. Why? It means one less thing that has to be remembered (two less things if you require 'English'). Instead of having to remember if __FILE__ = $0 # or $PROGRAM_NAME you have just have to remember in_main_file { stuff } It's prettier, too, and more explanatory (although I'll admit, I'm still not sure about the name). Nathaniel <:((>< + - - | RoleModel Software, Inc. | EQUIP VI