From: Rocky Bernstein Date: 2011-06-14T15:23:27+09:00 Subject: [ruby-core:37130] Re: [Ruby 1.9 - Feature #4824] Provide method Kernel#executed? --0016363b9728bae14a04a5a612be Content-Type: text/plain; charset=ISO-8859-1 On Mon, Jun 13, 2011 at 9:25 AM, Cezary wrote: > ... > > So why not instead check for specific script arguments, like '--demo', > '--test', '--help', etc.? If checking for '__FILE__ == $0' is really > the best solution in a given case, my question is: why provide a > special method for the same thing? > Simplicity. > > > I think we can tolerate different styles, no? > > Absolutely! So why not just use the following in such programs: > > def main?; __FILE__ == $0; end # for 'if main?' > Simplicity and unreliability. > ... > > As for tests - there already is a Rakefile which runs them. Why not > add a 'demo' task there as well? > Everything you suggest, adds more code. I want less boilerplate code in fewer files. That is what I meant by "lightweight". > ... > I would really like some clear guidelines for proposing and accepting > similar methods in the future. > Early on in the thread, Matz had said he was amenable to the idea of adding a method. But he was unsure about the name. If he had indicated he wasn't interested, I would have dropped the topic and never have posted a response initially. > > I don't really care if a method is added or not, I am really > interested in: on what basis was it decided that it is worth > considering? > > Ideally, a reason that would be more definite than just a matter of > taste or popularity. In my first post which you said I read, I also discussed why the idiom is unreliable. > ... --0016363b9728bae14a04a5a612be Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Mon, Jun 13, 2011 at 9:25 AM, Cezary = <cezary.b= aginski@gmail.com> wrote:
...

So why not instead check for specific script arguments, like '--demo= 9;,
'--test', '--help', etc.? If checking for '__FILE__ =3D= =3D $0' is really
the best solution in a given case, my question is: why provide a
special method for the same thing?

Simp= licity.
=A0

> I think we can tolerate different styles, no?

Absolutely! So why not just use the following in such programs:

=A0def main?; __FILE__ =3D=3D $0; end =A0 =A0 =A0# for 'if main?'<= br>

Simplicity and unreliability.
=A0
...

As for tests - there already is a Rakefile which runs them. Why not
add a 'demo' task there as well?

=A0Everything you suggest, adds more code. I want =A0less boilerplate cod= e in fewer files. That is what I meant by "lightweight".=A0=
=A0
...

I would really like some clear guidelines for proposing and accepting
similar methods in the future.

Early on= in the thread, Matz had said he was amenable to the idea of adding a metho= d. But he was unsure about the name. If he had indicated=A0he wasn't in= terested, I would have dropped the topic and never have posted a response i= nitially.
=A0

I don't really care if a method is added or not, I am really
interested in: on what basis was it decided that it is worth
considering?

Ideally, a reason that would be more definite than just a matter of
taste or popularity.

In my first post whic= h you said I read, I also discussed why the idiom is unreliable.
= =A0
...
--0016363b9728bae14a04a5a612be--