Forum: Ruby Is there a name for this idiom?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0276239ca57aee241d4b41379587fa20?d=identicon&s=25 Lyle Johnson (Guest)
on 2007-07-06 22:21
(Received via mailing list)
When you want to move your program's startup code into a block like so:

  if __FILE__ == $0
    # initialize and run program here
  end

What's that called? Is there a commonly used name for that "startup"
block?
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2007-07-06 22:24
(Received via mailing list)
On Jul 6, 2007, at 3:20 PM, Lyle Johnson wrote:

> When you want to move your program's startup code into a block like
> so:
>
>   if __FILE__ == $0
>     # initialize and run program here
>   end
>
> What's that called? Is there a commonly used name for that
> "startup" block?

I have referred to such a block of code as the "application code"
more than once, but I don't in anyway believe that's a standard name
for it.

James Edward Gray II
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-07-06 22:38
(Received via mailing list)
On Jul 6, 2007, at 3:23 PM, James Edward Gray II wrote:

>> "startup" block?
>
> I have referred to such a block of code as the "application code"
> more than once, but I don't in anyway believe that's a standard
> name for it.
>
> James Edward Gray II
>
How about "Am I me?" or "Worthless file name?"
334805ec86cb3fe1ac2eda776a921fb2?d=identicon&s=25 Brad Ediger (Guest)
on 2007-07-06 23:09
(Received via mailing list)
On Jul 6, 2007, at 3:23 PM, James Edward Gray II wrote:

>> block?
>
> I have referred to such a block of code as the "application code" more
> than once, but I don't in anyway believe that's a standard name for
> it.

Of course, that matches up with TextMate's tab trigger for that code:
app [tab].

Not as if you wrote the book on that or anything. :-)

Brad
This topic is locked and can not be replied to.