Is there a name for this idiom?

Discussion in 'Ruby' started by Lyle Johnson, Jul 6, 2007.

  1. Lyle Johnson

    Lyle Johnson Guest

    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?
     
    Lyle Johnson, Jul 6, 2007
    #1
    1. Advertising

  2. 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
     
    James Edward Gray II, Jul 6, 2007
    #2
    1. Advertising

  3. Lyle Johnson

    John Joyce Guest

    On Jul 6, 2007, at 3:23 PM, James Edward Gray II wrote:

    > 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
    >

    How about "Am I me?" or "Worthless file name?"
     
    John Joyce, Jul 6, 2007
    #3
  4. Lyle Johnson

    Brad Ediger Guest

    On Jul 6, 2007, at 3:23 PM, James Edward Gray II wrote:

    > 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.


    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
     
    Brad Ediger, Jul 6, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gareth Stockwell

    Name for a common idiom

    Gareth Stockwell, Oct 26, 2004, in forum: C++
    Replies:
    6
    Views:
    408
    Gianni Mariani
    Oct 27, 2004
  2. Per

    Is there such an idiom?

    Per, Mar 20, 2006, in forum: Python
    Replies:
    8
    Views:
    390
    Bruce Cropley
    Mar 20, 2006
  3. =?ISO-8859-1?Q?Ernesto_Garc=EDa_Garc=EDa?=

    Is there a commas-in-between idiom?

    =?ISO-8859-1?Q?Ernesto_Garc=EDa_Garc=EDa?=, Nov 5, 2006, in forum: Python
    Replies:
    14
    Views:
    470
    Peter van Kampen
    Nov 9, 2006
  4. Mark Probert

    Idiom -- is there a better way?

    Mark Probert, Oct 20, 2004, in forum: Ruby
    Replies:
    7
    Views:
    123
    John Carter
    Oct 21, 2004
  5. Kenneth McDonald

    Is there a standard "assert" idiom in Ruby?

    Kenneth McDonald, Aug 2, 2007, in forum: Ruby
    Replies:
    8
    Views:
    171
    John Carter
    Aug 3, 2007
Loading...

Share This Page