methods refer to methods triggered by an overloaded mathematical
operator.)
-Since overloading respects @ISA hierarchy, in fact the above
-declaration would also trigger overloading of C<+> and C<*=> in all
-the packages which inherit from C<Number>.
+Since overloading respects inheritance via the @ISA hierarchy, the
+above declaration would also trigger overloading of C<+> and C<*=> in
+all the packages which inherit from C<Number>.
=head2 Calling Conventions for Binary Operations
=head2 Inheritance and overloading
-There are two ways how inheritance interacts with overloading.
+Inheritance interacts with overloading in two ways.
=over
=item Strings as values of C<use overload> directive
-If the value of
+If C<value> in
use overload key => value;
-directive is a string, it is interpreted as a method name.
+is a string, it is interpreted as a method name.
=item Overloading of an operation is inherited by derived classes
-If any of ancestors is overloaded, so is the derived class. The set of
-overloaded methods is the union of overloaded methods of all the
-ancestors. If some method is overloaded in several ancestor, then
+Any class derived from an overloaded class is also overloaded. The
+set of overloaded methods is the union of overloaded methods of all
+the ancestors. If some method is overloaded in several ancestor, then
which description will be used is decided by the usual inheritance
-rules:
+rules:
-If C<A> inherits from C<B> and C<C> (in this order), and C<B>
-overloads C<+> by C<\&D::plus_sub>, C<C> overloads C<+> by
-C<"plus_meth">, then the subroutine C<D::plus_sub> will be called to
-implement operation C<+> for an object in package C<A>.
+If C<A> inherits from C<B> and C<C> (in this order), C<B> overloads
+C<+> with C<\&D::plus_sub>, and C<C> overloads C<+> by C<"plus_meth">,
+then the subroutine C<D::plus_sub> will be called to implement
+operation C<+> for an object in package C<A>.
=back
-Note that since the value of C<fallback> key is not a subroutine, its
-inheritance is not governed by the above rules. Current implementation
-is that the value of C<fallback> in the first overloaded ancestor is
-taken, but this may be subject to change.
+Note that since the value of the C<fallback> key is not a subroutine,
+its inheritance is not governed by the above rules. In the current
+implementation, the value of C<fallback> in the first overloaded
+ancestor is used, but this is accidental and subject to change.
=head1 SPECIAL SYMBOLS FOR C<use overload>
Three keys are recognized by Perl that are not covered by the above
description.
-=head2 Last Resort
+=head2 Last Resort
C<"nomethod"> should be followed by a reference to a function of four
parameters. If defined, it is called when the overloading mechanism
flag. Thus the only speed penalty during arithmetic operations without
overloading is the checking of this flag.
-In fact, if C<use overload> is not present, there is almost no overhead for
-overloadable operations, so most programs should not suffer measurable
-performance penalties. A considerable effort was made to minimize the overhead
-when overload is used in some package, but
-the arguments in question do not belong to packages using overload. When
-in doubt, test your speed with C<use overload> and without it. So far there
-have been no reports of substantial speed degradation if Perl is compiled
-with optimization turned on.
+In fact, if C<use overload> is not present, there is almost no overhead
+for overloadable operations, so most programs should not suffer
+measurable performance penalties. A considerable effort was made to
+minimize the overhead when overload is used in some package, but the
+arguments in question do not belong to packages using overload. When
+in doubt, test your speed with C<use overload> and without it. So far
+there have been no reports of substantial speed degradation if Perl is
+compiled with optimization turned on.
There is no size penalty for data if overload is not used. The only
size penalty if overload is used in some package is that I<all> the
=head1 BUGS
-Because it is used for overloading, the per-package associative array
-%OVERLOAD now has a special meaning in Perl. The symbol table is
-filled with names looking like line-noise.
+Because it is used for overloading, the per-package hash %OVERLOAD now
+has a special meaning in Perl. The symbol table is filled with names
+looking like line-noise.
For the purpose of inheritance every overloaded package behaves as if
C<fallback> is present (possibly undefined). This may create