Skip to content

Commit 9849f09

Browse files
committed
Remove $?USAGE / Document $*USAGE
Rakudo impl: rakudo/rakudo@0b15f6728a Spec: Raku/roast@04b03b1d40
1 parent 2ac4c00 commit 9849f09

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

doc/Language/functions.pod6

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,11 +931,11 @@ positional parameter. For example, the above program can be called with:
931931
=end code
932932
933933
=head1 C<sub USAGE>
934-
X<|USAGE>
934+
X<|USAGE>X<|$*USAGE>
935935
936936
If no multi candidate of C<MAIN> is found for the given command line
937937
parameters, the sub C<USAGE> is called. If no such method is found,
938-
the compiler will output a generated usage message.
938+
the compiler will output a default generated usage message.
939939
940940
sub MAIN(Int $i){ say $i == 42 ?? 'answer' !! 'dunno' }
941941
@@ -947,6 +947,9 @@ the compiler will output a generated usage message.
947947
EOH
948948
}
949949
950+
The default usage message is available inside C<sub USAGE> via read-only
951+
C<$*USAGE> variable.
952+
950953
=end pod
951954

952955
# vim: expandtab shiftwidth=4 ft=perl6

doc/Language/variables.pod6

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ for '.' {
10631063
10641064
Other compile-time variables:
10651065
1066-
X<|$?PACKAGE>X<|$?MODULE>X<|$?CLASS>X<|$?ROLE>X<|$?GRAMMAR>X<|$?TABSTOP>X<|$?USAGE>X<|$?ENC>
1066+
X<|$?PACKAGE>X<|$?MODULE>X<|$?CLASS>X<|$?ROLE>X<|$?GRAMMAR>X<|$?TABSTOP>X<|$?ENC>
10671067
10681068
=for table
10691069
$?PACKAGE Which package am I in?
@@ -1072,7 +1072,6 @@ X<|$?PACKAGE>X<|$?MODULE>X<|$?CLASS>X<|$?ROLE>X<|$?GRAMMAR>X<|$?TABSTOP>X<|$?USA
10721072
$?ROLE Which role am I in? (as variable)
10731073
$?GRAMMAR Which grammar am I in?
10741074
$?TABSTOP How many spaces is a tab in a heredoc or virtual margin?
1075-
$?USAGE The usage message generated from the signatures of MAIN subs.
10761075
$?ENC Default encoding of Str.encode/Buf.decode/various IO methods.
10771076
10781077
=head2 Dynamic variables
@@ -1083,7 +1082,7 @@ X<|$?PACKAGE>X<|$?MODULE>X<|$?CLASS>X<|$?ROLE>X<|$?GRAMMAR>X<|$?TABSTOP>X<|$?USA
10831082
X<|$*ARGFILES>X<|@*ARGS>X<|$*IN>X<|$*OUT>X<|$*ERR>X<|%*ENV>X<|$*REPO>X<|$*TZ>
10841083
X<|$*CWD>X<|$*KERNEL>X<|$*DISTRO>X<|$*VM>X<|$*PERL>X<|$*PID>X<|$*PROGRAM-NAME>
10851084
X<|$*PROGRAM>X<|$*EXECUTABLE>X<|$*EXECUTABLE-NAME>X<|$*USER>X<|$*GROUP>X<|$*HOME>
1086-
X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>
1085+
X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>X<|$*USAGE>
10871086
=begin table
10881087
$*ARGFILES | An IO::CatHandle that uses @*ARGS as source files, if
10891088
| it contains any files, or $*IN otherwise
@@ -1127,6 +1126,10 @@ X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>
11271126
| Favor $*EXECUTABLE because it's not guaranteed that the perl
11281127
| executable is in PATH.
11291128
------------------+--------------------------------------------
1129+
$*USAGE | Read-only. The default usage message generated from the
1130+
| signatures of MAIN subs available from inside
1131+
| sub MAIN and sub USAGE
1132+
------------------+--------------------------------------------
11301133
$*USER | The user that is running the program. It's an object
11311134
| that evaluates to "username (uid)". It will evaluate
11321135
| to the username only if treated as a string and the

0 commit comments

Comments
 (0)