Some other suggestions:

if main?
if first_script?
if main_script?
if run_script?


-Stephen

On Sat, Jun 4, 2011 at 5:48 PM, Cezary <cezary.baginski / gmail.com> wrote:
> On Sat, Jun 04, 2011 at 11:17:01PM +0900, Yukihiro Matsumoto wrote:
>>
>> I agree providing a method to tell whether it is loaded as a library
>> or is executed as a command is more elegant than '__FILE__ =3D=3D $0',
>> but I am still afraid #executed? can mean multiple ways so that the
>> name can cause confusion. =A0We need a better name.
>
> How about the inverse or something similar:
>
> =A0unless required? =A0# top-level file, not require'd or loaded
> =A0 =A0#main
> =A0 =A0puts "hello from main"
> =A0end
>
> This would also protect from main being run twice when the file
> includes itself.
>
>
> --
> Cezary Baginski
>
>