Skip to content

Commit 8f4b7c8

Browse files
committed
Document naming conventions
1 parent ec806e6 commit 8f4b7c8

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

doc/Language/variables.pod6

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,9 @@ X<|$?PACKAGE>X<|$?MODULE>X<|$?CLASS>X<|$?ROLE>X<|$?GRAMMAR>X<|$?TABSTOP>X<|$?ENC
10871087
10881088
X<|$*ARGFILES>X<|@*ARGS>X<|$*IN>X<|$*OUT>X<|$*ERR>X<|%*ENV>X<|$*REPO>X<|$*TZ>
10891089
X<|$*CWD>X<|$*KERNEL>X<|$*DISTRO>X<|$*VM>X<|$*PERL>X<|$*PID>X<|$*PROGRAM-NAME>
1090-
X<|$*PROGRAM>X<|$*EXECUTABLE>X<|$*EXECUTABLE-NAME>X<|$*USER>X<|$*GROUP>X<|$*HOME>
1091-
X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>X<|$*USAGE>
1090+
X<|$*PROGRAM>X<|$*EXECUTABLE>X<|$*EXECUTABLE-NAME>X<|$*USER>X<|$*GROUP>
1091+
X<|$*HOME>X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>X<|$*USAGE>
1092+
10921093
=begin table
10931094
$*ARGFILES | An L<IO::ArgFiles> (an empty subclass of L<IO::CatHandle>)
10941095
| that uses C<@*ARGS> as source files, if
@@ -1168,7 +1169,7 @@ X<|$*SPEC>X<|$*TMPDIR>X<|$*THREAD>X<|$*SCHEDULER>X<|$*USAGE>
11681169
$*SPEC | The appropriate L<IO::Spec> sub-class for the platform that
11691170
| the program is running on.
11701171
------------------+--------------------------------------------
1171-
$*TMPDIR | An L<IO::Path> object representing the "system temporary directory" as determined by L«C<.tmpdir IO::Spec::* method|/routine/tmpdir»
1172+
$*TMPDIR | An L<IO::Path> object representing the "system temporary directory" as determined by L«C<.tmpdir IO::Spec::* method|/routine/tmpdir>»
11721173
------------------+--------------------------------------------
11731174
$*TOLERANCE | Used by the C<=~=> operator, and any operations that depend on it, to
11741175
| decide if two values are approximately equal. Defaults to 1e-15.
@@ -1195,6 +1196,24 @@ with the default changed before using C<.hyper> or C<.race>:
11951196
11961197
This behavior is not tested in the spec tests and is subject to change.
11971198
1199+
=head1 Naming Conventions
1200+
1201+
It is helpful to know our naming conventions in order to understand what codes
1202+
do directly. However, there is not yet a conventions list covering anywhere.
1203+
Still we list several conventions that are widely held.
1204+
1205+
=item1 Subs and methods from the built-ins library try to have single-word names when a good one could be found. In cases where there are two or more words making up a name, they are separated by a "-".
1206+
1207+
=item1 Compounds are treated as a single word, thus C<substr>, C<subbuf>, and C<deepmap> (just like we write "starfish", not "star fish" in English).
1208+
1209+
=item1 Subs and methods that are automatically called for you at special times are written in uppercase. This includes the C<MAIN> sub, the C<AT-POS> and related methods for implementing container types, along with C<BUILD> and C<DESTROY>.
1210+
1211+
=item1 Type names are camel case, except for native types, which are lowercase. For the exception, you can remember it by: they are stored in a more compact way, so they names look smaller too.
1212+
1213+
=item1 Built-in dynamic variables and compile-time variables are always uppercase, such like C<$*OUT>, C<$?FILE>.
1214+
1215+
=item1 Methods from the MOP and other internals use "_" to separate multiple words, suck like C<add_method>.
1216+
11981217
=end pod
11991218

12001219
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)