[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Is there a name for this idiom?

Lyle Johnson

7/6/2007 8:21:00 PM

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?

3 Answers

James Gray

7/6/2007 8:24:00 PM

0

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

John Joyce

7/6/2007 8:37:00 PM

0


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

Brad Ediger

7/6/2007 9:08:00 PM

0

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