Skip to content

Commit

Permalink
[Book] Add a small bit of extra info about the :main subroutine. Need…
Browse files Browse the repository at this point in the history
…s major expansion on that point.

git-svn-id: https://svn.parrot.org/parrot/trunk@36814 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
Whiteknight committed Feb 17, 2009
1 parent c9c6ae3 commit 6617d95
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/book/ch04_pir_subroutines.pod
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ they're stored in typed integer variables. The C<fact> subroutine
uses C<.param> and the C<.return> directives for retrieving parameters
and returning results. The final printed result is 120.

Execution of the program starts at the C<:main> subroutine or, if no
subroutines are declared with C<:main> at the first subroutine in the file.
If multiple subroutines are declared with C<:main>, the last of them is
treated as the starting point. Eventually, declaring multiple subroutines
with C<:main> might cause a syntax error or some other bad behavior, so it's
not a good idea to rely on it now.

=head3 Named Parameters

Parameters that are passed in a strict order like we've seen above are
Expand Down Expand Up @@ -316,6 +323,17 @@ C<get_namespace> method:
Subroutine PMCs are very useful things, and we will show more of their uses
throughout this chapter.

=head2 The Commandline

Programs written in Parrot have access to arguments passed on the command
line like any other program would.

.sub MyMain :main
.param pmc all_args :slurpy
...
.end


=head2 Continuation Passing Style

Continuations are snapshots, a frozen image of the current execution
Expand Down

0 comments on commit 6617d95

Please sign in to comment.