@@ -536,22 +536,6 @@ attributes is not yet implemented. Please note that adding a multi candidate
536
536
that differs only in its named parameters will add that candidate behind the
537
537
already defined one and as such it won't be picked by the dispatcher.
538
538
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»
554
-
555
539
= head2 C < role >
556
540
557
541
X < |declarator,role (typesystem) >
@@ -690,22 +674,6 @@ say [(75kg).^name, N(75kg).^name];
690
674
# OUTPUT: «[Int+{SI-kilogram} Rat+{SI-Newton}]»
691
675
= end code
692
676
693
- = head3 Versioning, authorship, and API
694
-
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.
702
-
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»
708
-
709
677
X < |Enumeration; Enums; enum >
710
678
= head2 C < enum >
711
679
@@ -908,21 +876,6 @@ another Raku program.
908
876
909
877
For a full explanation see L < Modules|/language/modules > .
910
878
911
- = head3 Versioning, authorship, and API
912
-
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.
919
-
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»
925
-
926
879
= head2 C < package >
927
880
928
881
Packages are nested namespaces of named program elements. Modules, classes and
@@ -938,22 +891,6 @@ are classes.
938
891
939
892
For a full explanation see L < Grammars|/language/grammars > .
940
893
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»
956
-
957
894
= head2 C < subset >
958
895
959
896
A X < C < subset > |subset> declares a new type that will re-dispatch to its base
@@ -993,6 +930,31 @@ X<|dynamic subset>
993
930
require ::('YourModule');
994
931
subset C where ::('YourModule::C');
995
932
933
+ X « |:ver<> » X « |:auth<> » X « |:api<> »
934
+ = head1 Versioning, authorship, and API version.
935
+
936
+ When you declare a type, you can pass it a version, author, and/or API version,
937
+ all of which you can subsequently introspect. The versioning, authorship,
938
+ and/or API version of a type can be applied via the adverbs C « :ver<> » ,
939
+ C « :auth<> » , and C « :api<> » respectively. All of them take a string as argument;
940
+ for C < :ver > the string is converted to a L « C « Version » |/type/Version» object, and
941
+ for C < :api > the string is converted into an
942
+ L < allomorph|/language/glossary#index-entry-Allomorph >
943
+ L « C « IntStr » |/type/IntStr» object. To query the version, author, and API version
944
+ of a type use L < C < .^ver > |/type/Metamodel::Versioning#method_ver> ,
945
+ L < C < .^auth > |/type/Metamodel::Versioning#method_auth> , and
946
+ L < C < .^api > |/type/Metamodel::Versioning#method_api> respectively, as illustrated
947
+ down below by querying a C < class > .
948
+
949
+ class C:ver<4.2.3>:auth<me@here.local>:api<1> {}
950
+ say C.^ver; # OUTPUT: «v4.2.3»
951
+ say C.^ver.parts; # OUTPUT: «(4 2 3)»
952
+ say C.^auth; # OUTPUT: «me@here.local»
953
+ say C.^api; # OUTPUT: «1»
954
+
955
+ In a similar fashion, C < role > s, C < grammar > s, and C < module > s can be queried about
956
+ the aforementioned information.
957
+
996
958
= end pod
997
959
998
960
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
0 commit comments