At 5:11 PM -0700 8/10/06, [EMAIL PROTECTED] wrote:
Log:
First whack at defining semantics of MAIN subs.

Congradulations!  That is SUCH a great idea.

Since Perl didn't have the concept of an explicit 'main' before like many other languages, I had been doing this for a long while in my non-tiny Perl programs, to make code easier to read, more consistent, and properly isolate conceptual lexicals from conceptual globals|constants:

  # 'use' statements

  # declare constants

  main();

  sub main {
    ...
  }

  sub other {
    ...
  }

  # etc

Or alternately I did:

  # 'use' statements

  # declare constants

  MAIN: {
    ...
  }

  sub other {
    ...
  }

  # etc


And now there is a MAIN() that implicitly gets called, so no more "main();" invoke or "MAIN:" anonymous block.

One great thing that somehow I never thought to ask for.

And of course, the actual implementation is a lot better, with all the various command-line options|args being mapped to normal Perl 6 args in an easy to understand and powerful way.

The default USAGE() sub was a great idea too.

I am SO going to use this.

-- Darren Duncan

Reply via email to