Skip to content

Commit 4c49cea

Browse files
committed
Index :api and add bit of documentation
refs: #3308
1 parent 258b819 commit 4c49cea

File tree

1 file changed

+55
-39
lines changed

1 file changed

+55
-39
lines changed

doc/Language/typesystem.pod6

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -536,17 +536,21 @@ attributes is not yet implemented. Please note that adding a multi candidate
536536
that differs only in its named parameters will add that candidate behind the
537537
already defined one and as such it won't be picked by the dispatcher.
538538
539-
=head3 Versioning and authorship
540-
541-
Versioning and authorship can be applied via the adverbs
542-
X«C«:ver<>»|:ver<> (class)» and X«C«:auth<>»|:auth<> (class)».
543-
Both take a string as argument, for C<:ver> the string is converted to a
544-
L<Version|/type/Version> object. To query a class version and author use
545-
C<.^ver> and C<^.auth>.
546-
547-
class C:ver<4.2.3>:auth<me@here.local> {}
548-
say [C.^ver, C.^auth];
549-
# OUTPUT: «[v4.2.3 me@here.local]␤»
539+
=head3 Versioning, authorship, and API
540+
541+
Versioning, authorship, and API can be applied via the adverbs
542+
X«C«:ver<>»|:ver<> (class)», X«C«:auth<>»|:auth<> (class)», and
543+
X«C«:api<>»|:api<> (class)» respectively. All of them take a string as argument;
544+
for C<:ver> the string is converted to a L<Version|/type/Version> object,
545+
and for C<:api> the string is converted into the allomorph
546+
L«C«IntStr»|/type/IntStr». To query a class about its version, author, and API
547+
use C<.^ver>, C<.^auth>, and C<.^api> respectively.
548+
549+
class C:ver<4.2.3>:auth<me@here.local>:api<1> {}
550+
say C.^ver; # OUTPUT: «v4.2.3␤»
551+
say C.^ver.parts; # OUTPUT: «(4 2 3)␤»
552+
say C.^auth; # OUTPUT: «me@here.local␤»
553+
say C.^api; # OUTPUT: «1␤»
550554
551555
=head2 C<role>
552556
@@ -686,17 +690,21 @@ say [(75kg).^name, N(75kg).^name];
686690
# OUTPUT: «[Int+{SI-kilogram} Rat+{SI-Newton}]␤»
687691
=end code
688692
689-
=head3 Versioning and authorship
693+
=head3 Versioning, authorship, and API
690694
691-
Versioning and authorship can be applied via the adverbs
692-
X«C«:ver<>»|:ver<> (role)» and X«C«:auth<>»|:auth<> (role)».
693-
Both take a string as argument, for C<:ver> the string is converted to a
694-
L<Version|/type/Version> object. To query a role's version and author use
695-
C<.^ver> and C<^.auth>.
695+
Versioning, authorship, and API can be applied via the adverbs
696+
X«C«:ver<>»|:ver<> (role)», X«C«:auth<>»|:auth<> (role)», and
697+
X«C«:api<>»|:api<> (role)» respectively. All of them take a string as argument;
698+
for C<:ver> the string is converted to a L<Version|/type/Version> object,
699+
and for C<:api> the string is converted into the allomorph
700+
L«C«IntStr»|/type/IntStr». To query a role's version, author, and API
701+
use C<.^ver>, C<.^auth>, and C<.^api> respectively.
696702
697-
role R:ver<4.2.3>:auth<me@here.local> {}
698-
say [R.^ver, R.^auth];
699-
# OUTPUT: «[v4.2.3 me@here.local]␤»
703+
class R:ver<4.2.3>:auth<me@here.local>:api<1> {}
704+
say R.^ver; # OUTPUT: «v4.2.3␤»
705+
say R.^ver.parts; # OUTPUT: «(4 2 3)␤»
706+
say R.^auth; # OUTPUT: «me@here.local␤»
707+
say R.^api; # OUTPUT: «1␤»
700708
701709
X<|Enumeration; Enums; enum>
702710
=head2 C<enum>
@@ -900,16 +908,20 @@ another Raku program.
900908
901909
For a full explanation see L<Modules|/language/modules>.
902910
903-
=head3 Versioning and authorship
911+
=head3 Versioning, authorship, and API
904912
905-
Versioning and authorship can be applied via the adverbs C«:ver<>» and C«:auth<>».
906-
Both take a string as argument, for C<:ver> the string is converted to a
907-
L<Version|/type/Version> object. To query a modules version and author use
908-
C<.^ver> and C<^.auth>.
913+
Versioning, authorship, and API can be applied via the adverbs
914+
C«:ver<>», C«:auth<>», and C«:api<>» respectively. All of them take a string as
915+
argument; for C<:ver> the string is converted to a L<Version|/type/Version> object,
916+
and for C<:api> the string is converted into the allomorph
917+
L«C«IntStr»|/type/IntStr». To query a module's version, author, and API
918+
use C<.^ver>, C<.^auth>, and C<.^api> respectively.
909919
910-
module M:ver<4.2.3>:auth<me@here.local> {}
911-
say [M.^ver, M.^auth];
912-
# OUTPUT: «[v4.2.3 me@here.local]␤»
920+
class M:ver<4.2.3>:auth<me@here.local>:api<1> {}
921+
say M.^ver; # OUTPUT: «v4.2.3␤»
922+
say M.^ver.parts; # OUTPUT: «(4 2 3)␤»
923+
say M.^auth; # OUTPUT: «me@here.local␤»
924+
say M.^api; # OUTPUT: «1␤»
913925
914926
=head2 C<package>
915927
@@ -926,17 +938,21 @@ are classes.
926938
927939
For a full explanation see L<Grammars|/language/grammars>.
928940
929-
=head3 Versioning and authorship
930-
931-
Versioning and authorship can be applied via the adverbs
932-
X«C«:ver<>»|:ver<> (grammar)» and X«C«:auth<>»|:auth<> (grammar)».
933-
Both take a string as argument, for C<:ver> the string is converted to a
934-
L<Version|/type/Version> object. To query a grammars version and author use
935-
C<.^ver> and C<^.auth>.
936-
937-
grammar G:ver<4.2.3>:auth<me@here.local> {}
938-
say [G.^ver, G.^auth];
939-
# OUTPUT: «[v4.2.3 me@here.local]␤»
941+
=head3 Versioning, authorship, and API
942+
943+
Versioning, authorship, and API can be applied via the adverbs
944+
X«C«:ver<>»|:ver<> (grammar)», X«C«:auth<>»|:auth<> (grammar)», and
945+
X«C«:api<>»|:api<> (grammar)» respectively. All of them take a string as argument;
946+
for C<:ver> the string is converted to a L<Version|/type/Version> object,
947+
and for C<:api> the string is converted into the allomorph
948+
L«C«IntStr»|/type/IntStr». To query a grammar about its version, author, and API
949+
use C<.^ver>, C<.^auth>, and C<.^api> respectively.
950+
951+
class G:ver<4.2.3>:auth<me@here.local>:api<1> {}
952+
say G.^ver; # OUTPUT: «v4.2.3␤»
953+
say G.^ver.parts; # OUTPUT: «(4 2 3)␤»
954+
say G.^auth; # OUTPUT: «me@here.local␤»
955+
say G.^api; # OUTPUT: «1␤»
940956
941957
=head2 C<subset>
942958

0 commit comments

Comments
 (0)