@@ -552,7 +552,7 @@ provide that method, the method of that name in one of the parent classes is
552
552
invoked instead, if it exists. The order in which parent classes are
553
553
consulted is called the I < method resolution order > (MRO). Perl 6 uses the
554
554
L < C3 method resolution order|https://en.wikipedia.org/wiki/C3_linearization > .
555
- You can ask a type for its MRO through a call to its meta class :
555
+ You can ask a type for its MRO through a call to its metaclass :
556
556
557
557
= for code
558
558
say List.^mro; # ((List) (Cool) (Any) (Mu))
@@ -933,7 +933,7 @@ then C<X::Ouch> will inherit directly from Exception, as we can see above
933
933
by listing its parents.
934
934
935
935
As they do not use what can properly be called inheritance, roles are not part
936
- of the class hierarchy. Roles are listed with the C < .^roles > meta-method
936
+ of the class hierarchy. Roles are listed with the C < .^roles > metamethod
937
937
instead, which uses C < transitive > as flag for including all levels or just the
938
938
first one. Despite this, a class or instance may still be tested with
939
939
smartmatches or type constraints to see if it does a role.
@@ -1003,7 +1003,7 @@ say Point.dimensions; # OUTPUT «2»
1003
1003
We call this automatic creation of classes I < punning > , and the generated class
1004
1004
a I < pun > .
1005
1005
1006
- Punning is not caused by most L < meta-programming |/language/mop> constructs,
1006
+ Punning is not caused by most L < metaprogramming |/language/mop> constructs,
1007
1007
however, as those are sometimes used to work directly with roles.
1008
1008
1009
1009
X < |Parameterized Roles >
@@ -1137,35 +1137,33 @@ say %seen<not-there>.defined; # OUTPUT: «True» (0 may be False but is well
1137
1137
say Int.new(%seen<not-there>); # OUTPUT: «0»
1138
1138
= end code
1139
1139
1140
- = head1 Meta-object programming and introspection
1140
+ = head1 Metaobject programming and introspection
1141
1141
1142
- Perl 6 has a meta object system, which means that the behavior of objects,
1142
+ Perl 6 has a metaobject system, which means that the behavior of objects,
1143
1143
classes, roles, grammars, enums, etc. are themselves controlled by other
1144
- objects; those objects are called I < meta objects > . Meta objects are, like
1145
- ordinary objects, instances of classes, in this case we call them I < meta
1146
- classes > .
1144
+ objects; those objects are called I < metaobjects > . Metaobjects are, like
1145
+ ordinary objects, instances of classes, in this case we call them I < metaclasses > .
1147
1146
1148
- For each object or class you can get the meta object by calling C < .HOW > on it.
1147
+ For each object or class you can get the metaobject by calling C < .HOW > on it.
1149
1148
Note that although this looks like a method call, it works more like a macro.
1150
1149
1151
- So, what can you do with the meta object ? For one you can check if two
1152
- objects have the same meta class by comparing them for equality:
1150
+ So, what can you do with the metaobject ? For one you can check if two
1151
+ objects have the same metaclass by comparing them for equality:
1153
1152
1154
1153
= begin code
1155
1154
say 1.HOW === 2.HOW; # OUTPUT: «True»
1156
1155
say 1.HOW === Int.HOW; # OUTPUT: «True»
1157
1156
say 1.HOW === Num.HOW; # OUTPUT: «False»
1158
1157
= end code
1159
1158
1160
- Perl 6 uses the word I < HOW > (Higher Order Workings) to refer to the meta
1161
- object system. Thus it should be no surprise that in Rakudo, the class name
1162
- of the meta class that controls class behavior is called
1163
- C < Perl6::Metamodel::ClassHOW > . For each class there is one instance of
1164
- C < Perl6::Metamodel::ClassHOW > .
1159
+ Perl 6 uses the word I < HOW > (Higher Order Workings) to refer to the metaobject
1160
+ system. Thus it should be no surprise that in Rakudo, the class name of the
1161
+ metaclass that controls class behavior is called C < Perl6::Metamodel::ClassHOW > .
1162
+ For each class there is one instance of C < Perl6::Metamodel::ClassHOW > .
1165
1163
1166
- But of course the meta model does much more for you. For example, it allows
1164
+ But of course the metamodel does much more for you. For example, it allows
1167
1165
you to introspect objects and classes. The calling convention for methods on
1168
- meta objects is to call the method on the meta object and pass in the object
1166
+ metaobjects is to call the method on the metaobject and pass in the object
1169
1167
of interest as first argument to the object. So to get the name of the class
1170
1168
of an object, you could write:
1171
1169
@@ -1179,7 +1177,7 @@ say 1.HOW.name(1); # OUTPUT: «Int»
1179
1177
= end code
1180
1178
1181
1179
(The motivation is that Perl 6 also wants to allow a more prototype-based
1182
- object system, where it's not necessary to create a new meta object for
1180
+ object system, where it's not necessary to create a new metaobject for
1183
1181
every type).
1184
1182
1185
1183
There's a shortcut to keep from using the same object twice:
@@ -1190,9 +1188,9 @@ say 1.^name; # OUTPUT: «Int»
1190
1188
say 1.HOW.name(1); # OUTPUT: «Int»
1191
1189
= end code
1192
1190
1193
- See L < Metamodel::ClassHOW|/type/Metamodel::ClassHOW > for documentation on
1194
- the meta class of C < class > and also the L < general documentation on the meta
1195
- object protocol|/language/mop> .
1191
+ See L < Metamodel::ClassHOW|/type/Metamodel::ClassHOW > for documentation on the
1192
+ metaclass of C < class > and also the L < general documentation on the metaobject
1193
+ protocol|/language/mop > .
1196
1194
1197
1195
= end pod
1198
1196
0 commit comments