[perldocjp-cvs 388] CVS update: docs/perl/5.6.1

Back to archive index

argra****@users***** argra****@users*****
2009年 2月 1日 (日) 00:25:31 JST


Index: docs/perl/5.6.1/overload.pod
diff -u docs/perl/5.6.1/overload.pod:1.3 docs/perl/5.6.1/overload.pod:1.4
--- docs/perl/5.6.1/overload.pod:1.3	Tue Jun 15 23:58:04 2004
+++ docs/perl/5.6.1/overload.pod	Sun Feb  1 00:25:31 2009
@@ -1,3 +1,6 @@
+
+=encoding euc-jp
+
 =head1 NAME
 
 =begin original
@@ -6,7 +9,7 @@
 
 =end original
 
-overload - Perl の演算子の多重定義を行うパッケージ
+overload - Perl の演算子のオーバーロードを行うパッケージ
 
 =head1 SYNOPSIS
 
@@ -30,7 +33,7 @@
 
 =head2 Declaration of overloaded functions
 
-(多重定義関数の宣言)
+(オーバーロード関数の宣言)
 
 =begin original
 
@@ -54,8 +57,8 @@
 =end original
 
 では、加法の関数 Number::add() と「クラス」C<Number> (あるいは、
-基底クラスの 1 つ) の中の乗法の代入形式 C<*=> のメソッド muas()
-を宣言しています。
+その基底クラスの 1 つ) の中の乗法の代入形式 C<*=> のメソッド muas() を
+宣言しています。
 
 =begin original
 
@@ -95,16 +98,24 @@
 サブルーチン C<add> が呼び出されます。
 これは、C<$a+=7> とか C<$a++> といった、シチュエーションでも呼ばれます。
 L<MAGIC AUTOGENERATION> の節を参照してください。
-(「マスマジカル」という言葉は、多重定義された
-マスマティカル演算子によって起動されるメソッドを指しています。)
+(「マスマジカル」という言葉は、オーバーロードされた
+算術演算子によって起動されるメソッドを指しています。)
+
+=begin original
 
 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>.
 
+=end original
+
+オーバーロードは @ISA 階層による継承を遵守するので、上述の宣言は
+C<Number> から継承される全てのパッケージの C<+> と C<*=> のオーバーロードも
+引き起こすことになります。
+
 =head2 Calling Conventions for Binary Operations
 
-(二項演算子の呼び出し方)
+(二項演算子の呼び出し規約)
 
 =begin original
 
@@ -122,12 +133,12 @@
 
 =end original
 
-C<use overload ...> 指示子の value の関数は、
+C<use overload ...> 指示子で指定される関数は、
 3 つ (唯一特別な場合があって、
 その時は 4 つ (L<Last Resort>の節を参照) ) の引数で呼び出されます。
 対応する演算子が、二項演算子であれば、最初の 2 つの引数は、
 その演算子の 2 つの引数です。
-しかしながら、通常のオブジェクトメソッドの呼び出し法の規則によって、
+しかしながら、通常のオブジェクトメソッドの呼び出し規約によって、
 最初の引数は、常にそのパッケージのオブジェクトでなければなりませんので、
 C<7+$a> のような場合には、引数の順序の入れ替えが行なわれます。
 これは、加法のメソッドを実装する時には、
@@ -149,17 +160,19 @@
 
 =end original
 
-引数の順序は、現在の演算子でのものと同じである。
+引数の順序は、現在の演算子でのものと同じです。
 
 =item TRUE
 
+(真)
+
 =begin original
 
 the arguments are reversed.
 
 =end original
 
-引数は、逆になっている。
+引数は、逆になっています。
 
 =item C<undef>
 
@@ -172,17 +185,17 @@
 
 =end original
 
-現在の演算子は、(C<$a+=7> のような) 代入形式のものであるが、
-普通の関数が、代わりに呼ばれる。
-この付加的な情報は、何らかの最適化を行なうときに、
-使用することができる。
+現在の演算子は、(C<$a+=7> のような) 代入形式のものですが、
+代わりに普通の関数が呼ばれます。
+この付加的な情報は、何らかの最適化を行なうときに
+使用できます。
 L<Calling Conventions for Mutators> と比較してください。
 
 =back
 
 =head2 Calling Conventions for Unary Operations
 
-(単項演算子の呼び出し方)
+(単項演算子の呼び出し規約)
 
 =begin original
 
@@ -194,64 +207,154 @@
 
 単項演算子は、2 番目の引数が C<undef> の二項演算子であると
 考えられます。
-つまり、C<{"++"}> を多重定義する関数は、
+つまり、C<{"++"}> をオーバーロードする関数は、
 $a++ が実行されるときに、C<($a, undef, '')> という引数で呼び出されます。
 
 =head2 Calling Conventions for Mutators
 
+(ミューテータの呼び出し規約)
+
+=begin original
+
 Two types of mutators have different calling conventions:
 
+=end original
+
+2 種類のミューテータは異なった呼び出し規約を持ちます:
+
 =over
 
 =item C<++> and C<-->
 
+=begin original
+
+The routines which implement these operators are expected to actually
+I<mutate> their arguments.  So, assuming that $obj is a reference to a
+number,
+
+=end original
+
 The routines which implement these operators are expected to actually
 I<mutate> their arguments.  So, assuming that $obj is a reference to a
 number,
+(TBT)
 
   sub incr { my $n = $ {$_[0]}; ++$n; $_[0] = bless \$n}
 
+=begin original
+
+is an appropriate implementation of overloaded C<++>.  Note that
+
+=end original
+
 is an appropriate implementation of overloaded C<++>.  Note that
+(TBT)
 
   sub incr { ++$ {$_[0]} ; shift }
 
+=begin original
+
+is OK if used with preincrement and with postincrement. (In the case
+of postincrement a copying will be performed, see L<Copy Constructor>.)
+
+=end original
+
 is OK if used with preincrement and with postincrement. (In the case
 of postincrement a copying will be performed, see L<Copy Constructor>.)
+(TBT)
 
 =item C<x=> and other assignment versions
 
+=begin original
+
+There is nothing special about these methods.  They may change the
+value of their arguments, and may leave it as is.  The result is going
+to be assigned to the value in the left-hand-side if different from
+this value.
+
+=end original
+
 There is nothing special about these methods.  They may change the
 value of their arguments, and may leave it as is.  The result is going
 to be assigned to the value in the left-hand-side if different from
 this value.
+(TBT)
+
+=begin original
+
+This allows for the same method to be used as overloaded C<+=> and
+C<+>.  Note that this is I<allowed>, but not recommended, since by the
+semantic of L<"Fallback"> Perl will call the method for C<+> anyway,
+if C<+=> is not overloaded.
+
+=end original
 
 This allows for the same method to be used as overloaded C<+=> and
 C<+>.  Note that this is I<allowed>, but not recommended, since by the
 semantic of L<"Fallback"> Perl will call the method for C<+> anyway,
 if C<+=> is not overloaded.
+(TBT)
 
 =back
 
+=begin original
+
+B<Warning.>  Due to the presense of assignment versions of operations,
+routines which may be called in assignment context may create
+self-referential structures.  Currently Perl will not free self-referential
+structures until cycles are C<explicitly> broken.  You may get problems
+when traversing your structures too.
+
+=end original
+
 B<Warning.>  Due to the presense of assignment versions of operations,
 routines which may be called in assignment context may create
 self-referential structures.  Currently Perl will not free self-referential
 structures until cycles are C<explicitly> broken.  You may get problems
 when traversing your structures too.
+(TBT)
+
+=begin original
 
 Say,
 
+=end original
+
+以下のようにすると、
+
   use overload '+' => sub { bless [ \$_[0], \$_[1] ] };
 
+=begin original
+
+is asking for trouble, since for code C<$obj += $foo> the subroutine
+is called as C<$obj = add($obj, $foo, undef)>, or C<$obj = [\$obj,
+\$foo]>.  If using such a subroutine is an important optimization, one
+can overload C<+=> explicitly by a non-"optimized" version, or switch
+to non-optimized version if C<not defined $_[2]> (see
+L<Calling Conventions for Binary Operations>).
+
+=end original
+
 is asking for trouble, since for code C<$obj += $foo> the subroutine
 is called as C<$obj = add($obj, $foo, undef)>, or C<$obj = [\$obj,
 \$foo]>.  If using such a subroutine is an important optimization, one
 can overload C<+=> explicitly by a non-"optimized" version, or switch
 to non-optimized version if C<not defined $_[2]> (see
 L<Calling Conventions for Binary Operations>).
+(TBT)
+
+=begin original
+
+Even if no I<explicit> assignment-variants of operators are present in
+the script, they may be generated by the optimizer.  Say, C<",$obj,"> or
+C<',' . $obj . ','> may be both optimized to
+
+=end original
 
 Even if no I<explicit> assignment-variants of operators are present in
 the script, they may be generated by the optimizer.  Say, C<",$obj,"> or
 C<',' . $obj . ','> may be both optimized to
+(TBT)
 
   my $tmp = ',' . $obj;    $tmp .= ',';
 
@@ -399,41 +502,90 @@
 
 =end original
 
-これらの中で多重定義していないものがあっても、残りが一つで
+これらの中でオーバーロードしていないものがあっても、残りが一つで
 も定義してあれば、それを代わりに使うことができます。
 C<bool> は、(C<while> のような) フロー制御演算子や、
 三項演算子 "C<?:>" で使われます。
 これらの関数は、任意の Perl値を返すことができます。
-この値に対応する演算子も多重定義されている場合には、
+この値に対応する演算子もオーバーロードされている場合には、
 その演算子がその時の値を使って、再度呼び出されることになります。
 
+=begin original
+
+As a special case if the overload returns the object itself then it will
+be used directly. An overloaded conversion returning the object is
+probably a bug, because you're likely to get something that looks like
+C<YourPackage=HASH(0x8172b34)>.
+
+=end original
+
 As a special case if the overload returns the object itself then it will
 be used directly. An overloaded conversion returning the object is
 probably a bug, because you're likely to get something that looks like
 C<YourPackage=HASH(0x8172b34)>.
+(TBT)
 
 =item * I<Iteration>
 
+(I<反復子>)
+
     "<>"
 
+=begin original
+
+If not overloaded, the argument will be converted to a filehandle or
+glob (which may require a stringification).  The same overloading
+happens both for the I<read-filehandle> syntax C<E<lt>$varE<gt>> and
+I<globbing> syntax C<E<lt>${var}E<gt>>.
+
+=end original
+
 If not overloaded, the argument will be converted to a filehandle or
 glob (which may require a stringification).  The same overloading
 happens both for the I<read-filehandle> syntax C<E<lt>$varE<gt>> and
 I<globbing> syntax C<E<lt>${var}E<gt>>.
+(TBT)
 
 =item * I<Dereferencing>
 
+(I<デリファレンス>)
+
     '${}', '@{}', '%{}', '&{}', '*{}'.
 
+=begin original
+
+If not overloaded, the argument will be dereferenced I<as is>, thus
+should be of correct type.  These functions should return a reference
+of correct type, or another object with overloaded dereferencing.
+
+=end original
+
 If not overloaded, the argument will be dereferenced I<as is>, thus
 should be of correct type.  These functions should return a reference
 of correct type, or another object with overloaded dereferencing.
+(TBT)
+
+=begin original
+
+As a special case if the overload returns the object itself then it
+will be used directly (provided it is the correct type).
+
+=end original
 
 As a special case if the overload returns the object itself then it
 will be used directly (provided it is the correct type).
+(TBT)
+
+=begin original
+
+The dereference operators must be specified explicitly they will not be passed to
+"nomethod".
+
+=end original
 
 The dereference operators must be specified explicitly they will not be passed to
 "nomethod".
+(TBT)
 
 =item * I<Special>
 
@@ -460,9 +612,16 @@
 
 存在しないメソッドの自動生成についての説明は L<"Fallback"> を参照して下さい。
 
+=begin original
+
 A computer-readable form of the above table is available in the hash
 %overload::ops, with values being space-separated lists of names:
 
+=end original
+
+上述のテーブルのコンピュータ可読形式は、ハッシュ %overload::ops で
+利用可能です; 値は空白で区切られた名前のリストです:
+
  with_assign	  => '+ - * / % ** << >> x .',
  assign		  => '+= -= *= /= %= **= <<= >>= x= .=',
  num_comparison	  => '< <= > >= == !=',
@@ -493,32 +652,79 @@
 
 =item Strings as values of C<use overload> directive
 
+(C<use overload> 指示子の値としての文字列)
+
+=begin original
+
 If C<value> in
 
+=end original
+
+もし以下での C<value> が
+
   use overload key => value;
 
+=begin original
+
 is a string, it is interpreted as a method name.
 
+=end original
+
+文字列の場合、メソッド名として解釈されます。
+
 =item Overloading of an operation is inherited by derived classes
 
+(操作のオーバーロードは派生クラスによって継承される)
+
+=begin original
+
+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:
+
+=end original
+
 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:
+(TBT)
+
+=begin original
+
+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>.
+
+=end original
 
 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>.
+(TBT)
 
 =back
 
+=begin original
+
 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.
 
+=end original
+
+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.
+(TBT)
+
 =head1 SPECIAL SYMBOLS FOR C<use overload>
 
 (C<use overload> の特殊シンボル)
@@ -549,7 +755,7 @@
 =end original
 
 C<"nomethod"> は、4 つのパラメータを持つ関数へのリファレンスが引き続きます。
-これが定義されていれば、多重定義の仕組みで、
+これが定義されていれば、オーバーロードの仕組みで、
 何らかの演算子に対するメソッドを見つけることができなかったときに、
 呼び出されます。
 この関数の最初の 3 つの引数は、本来、
@@ -685,7 +891,7 @@
 
 C<"="> の値は、3 引数の関数へのリファレンスです。
 つまり、C<use overload> の他の値と似ているように見えます。
-しかし、これは Perl の代入演算子を多重定義しません。
+しかし、これは Perl の代入演算子をオーバーロードしません。
 これは「ラクダの毛(Camel hair)」に対抗しています。
 
 =begin original
@@ -753,27 +959,53 @@
 
 (B<例>)
 
+=begin original
+
 The actually executed code for
 
+=end original
+
+以下の記述で
+
 	$a=$b;
         Something else which does not modify $a or $b....
 	++$a;
 
+=begin original
+
 may be
 
+=end original
+
+実際に実行されるコードは以下のようになります
+
 	$a=$b;
         Something else which does not modify $a or $b....
 	$a = $a->clone(undef,"");
         $a->incr(undef,"");
 
+=begin original
+
 if $b was mathemagical, and C<'++'> was overloaded with C<\&incr>,
 C<'='> was overloaded with C<\&clone>.
 
+=end original
+
+(もし $b がマスマジカルで、C<'++'> が C<\&incr> でオーバーロードされていて、
+C<'='> が C<\&clone> でオーバーロードされていれば。)
+
 =back
 
+=begin original
+
 Same behaviour is triggered by C<$b = $a++>, which is consider a synonym for
 C<$b = $a; ++$a>.
 
+=end original
+
+同じ振る舞いは C<$b = $a++> で引き起こされます; これは
+C<$b = $a; ++$a> と同義として扱われます。
+
 =head1 MAGIC AUTOGENERATION
 
 (マジック自動生成)
@@ -971,35 +1203,82 @@
 
 (実行時オーバーロード)
 
+=begin original
+
 Since all C<use> directives are executed at compile-time, the only way to
 change overloading during run-time is to
 
+=end original
+
+全ての C<use> 指示子はコンパイル時に実行されるので、実行時にオーバーロードを
+変更する唯一の方法は以下のものです
+
     eval 'use overload "+" => \&addmethod';
 
+=begin original
+
 You can also use
 
+=end original
+
+また、以下のようにもできます
+
     eval 'no overload "+", "--", "<="';
 
+=begin original
+
 though the use of these constructs during run-time is questionable.
 
+=end original
+
+しかし実行時にこのような構文を使うのは問題が多いです。
+
 =head1 Public functions
 
+(パブリック関数)
+
+=begin original
+
 Package C<overload.pm> provides the following public functions:
 
+=end original
+
+パッケージ C<overload.pm> は以下のパブリック関数を提供します:
+
 =over 5
 
 =item overload::StrVal(arg)
 
+=begin original
+
 Gives string value of C<arg> as in absence of stringify overloading.
 
+=end original
+
+文字列化のオーバーロードがないものとしたときの C<arg> の文字列値を
+与えます。
+
 =item overload::Overloaded(arg)
 
+=begin original
+
 Returns true if C<arg> is subject to overloading of some operations.
 
+=end original
+
+C<arg> が何らかの操作のオーバーロードの影響下にあるなら真を返します。
+
 =item overload::Method(obj,op)
 
+=begin original
+
 Returns C<undef> or a reference to the method that implements C<op>.
 
+=end original
+
+C<op> を実装しているメソッドへのリファレンス、あるいは C<undef> を
+返します。
+
 =back
 
 =head1 Overloading constants
@@ -1032,27 +1311,75 @@
 
 =item integer
 
+=begin original
+
 to overload integer constants,
 
+=end original
+
+整数定数をオーバーロードします。
+
 =item float
 
+=begin original
+
 to overload floating point constants,
 
+=end original
+
+浮動小数点数定数をオーバーロードします。
+
 =item binary
 
+=begin original
+
 to overload octal and hexadecimal constants,
 
+=end original
+
+8 進および 16 進定数をオーバーロードします。
+
 =item q
 
+=begin original
+
 to overload C<q>-quoted strings, constant pieces of C<qq>- and C<qx>-quoted
 strings and here-documents,
 
+=end original
+
+C<q>-クォートされた文字列、C<qq>- および C<qx>-クォートされた文字列の
+定数片、ヒヤドキュメントをオーバーロードします。
+
 =item qr
 
+=begin original
+
 to overload constant pieces of regular expressions.
 
+=end original
+
+正規表現の定数片をオーバーロードします。
+
 =back
 
+=begin original
+
+The corresponding values are references to functions which take three arguments:
+the first one is the I<initial> string form of the constant, the second one
+is how Perl interprets this constant, the third one is how the constant is used.
+Note that the initial string form does not
+contain string delimiters, and has backslashes in backslash-delimiter
+combinations stripped (thus the value of delimiter is not relevant for
+processing of this string).  The return value of this function is how this
+constant is going to be interpreted by Perl.  The third argument is undefined
+unless for overloaded C<q>- and C<qr>- constants, it is C<q> in single-quote
+context (comes from strings, regular expressions, and single-quote HERE
+documents), it is C<tr> for arguments of C<tr>/C<y> operators,
+it is C<s> for right-hand side of C<s>-operator, and it is C<qq> otherwise.
+
+=end original
+
 The corresponding values are references to functions which take three arguments:
 the first one is the I<initial> string form of the constant, the second one
 is how Perl interprets this constant, the third one is how the constant is used.
@@ -1065,15 +1392,35 @@
 context (comes from strings, regular expressions, and single-quote HERE
 documents), it is C<tr> for arguments of C<tr>/C<y> operators,
 it is C<s> for right-hand side of C<s>-operator, and it is C<qq> otherwise.
+(TBT)
+
+=begin original
+
+Since an expression C<"ab$cd,,"> is just a shortcut for C<'ab' . $cd . ',,'>,
+it is expected that overloaded constant strings are equipped with reasonable
+overloaded catenation operator, otherwise absurd results will result.
+Similarly, negative numbers are considered as negations of positive constants.
+
+=end original
 
 Since an expression C<"ab$cd,,"> is just a shortcut for C<'ab' . $cd . ',,'>,
 it is expected that overloaded constant strings are equipped with reasonable
 overloaded catenation operator, otherwise absurd results will result.
 Similarly, negative numbers are considered as negations of positive constants.
+(TBT)
+
+=begin original
+
+Note that it is probably meaningless to call the functions overload::constant()
+and overload::remove_constant() from anywhere but import() and unimport() methods.
+From these methods they may be called as
+
+=end original
 
 Note that it is probably meaningless to call the functions overload::constant()
 and overload::remove_constant() from anywhere but import() and unimport() methods.
 From these methods they may be called as
+(TBT)
 
 	sub import {
 	  shift;
@@ -1082,9 +1429,15 @@
 	  overload::constant integer => sub {Math::BigInt->new(shift)};
 	}
 
+=begin original
+
 B<BUGS> Currently overloaded-ness of constants does not propagate
 into C<eval '...'>.
 
+=end original
+
+B<バグ> 現在のところ、定数のオーバーロード性は C<eval '...'> に伝播しません。
+
 =head1 IMPLEMENTATION
 
 (実装)
@@ -1115,7 +1468,7 @@
 @ISA の変更のいずれかの処理の間に無効化されます。
 しかし、この無効化はパッケージに対する次の C<bless> までは
 実行されずに残されます。
-つまり、多重定義構造を動的に変更したいならば、テーブルを
+つまり、オーバーロード構造を動的に変更したいならば、テーブルを
 更新するために、(意味の無い) C<bless> を行なう必要があります。
 
 =begin original
@@ -1136,7 +1489,7 @@
 関ることができるのです。
 たとえば、環境変数は普段、%ENV マジックと「汚染」マジックの
 2 つの形式を一度に持っています。
-しかし、多重定義を実装しているマジックは隠してあるものに
+しかし、オーバーロードを実装しているマジックは隠してあるものに
 適用され、これはめったに直接使うことはないため、
 Perl の速度を低下させないはずです。)
 
@@ -1148,9 +1501,9 @@
 
 =end original
 
-オブジェクトが多重定義を使うパッケージに属するならば、
+オブジェクトがオーバーロードを使うパッケージに属するならば、
 そのオブジェクトには、特別なフラグが用意されます。
-つまり、多重定義されていない算術演算を行なうときの、
+つまり、オーバーロードされていない算術演算を行なうときの、
 スピードに対する影響は、このフラグのチェックのみです。
 
 =begin original
@@ -1166,11 +1519,11 @@
 
 =end original
 
-実際、C<use overload> が存在しなければ、多重定義可能な演算に
+実際、C<use overload> が存在しなければ、オーバーロード可能な演算に
 対するオーバヘッドはほとんど無く、ほとんどのプログラムで、
 認識できるようなパフォーマスの低下はないはずです。
-あるパッケージで多重定義が使われても、
-対象の引数が多重定義を使ったパッケージに属していない場合には、
+あるパッケージでオーバーロードが使われても、
+対象の引数がオーバーロードを使ったパッケージに属していない場合には、
 オーバヘッドの最小限にする最大限の努力が為されました。
 疑わしいときには、C<use overload> がある場合と無い場合で、
 スピードのテストをしてください。 これまでのところ、Perl が
@@ -1187,12 +1540,12 @@
 
 =end original
 
-多重定義が使われないときには、データの大きさには影響しません。
-あるパッケージで多重定義を使うときの唯一のサイズペナルティは、
+オーバーロードが使われないときには、データの大きさには影響しません。
+あるパッケージでオーバーロードを使うときの唯一のサイズペナルティは、
 I<全ての>パッケージが次のパッケージへの C<bless> 時に
 マジックを求めることです。
-このマジックは多重定義を使わないパッケージの場合は 3 ワード長で、
-多重定義を使うパッケージの場合はキャッシュテーブルを運びます。
+このマジックはオーバーロードを使わないパッケージの場合は 3 ワード長で、
+オーバーロードを使うパッケージの場合はキャッシュテーブルを運びます。
 
 =begin original
 
@@ -1222,18 +1575,54 @@
 
 =head1 Metaphor clash
 
+(比喩の衝突)
+
+=begin original
+
 One may wonder why the semantic of overloaded C<=> is so counter intuitive.
 If it I<looks> counter intuitive to you, you are subject to a metaphor
 clash.
 
+=end original
+
+なぜオーバーロードされた C<=> の意味論がこんなに直感的でないかを
+不思議に思う人がいるかもしれません。
+もし直感的でない I<ように見える> なら、比喩の衝突に影響されています。
+
+=begin original
+
 Here is a Perl object metaphor:
 
+=end original
+
+Perl のオブジェクトの比喩はこれです:
+
+=begin original
+
 I<  object is a reference to blessed data>
 
+=end original
+
+I<  オブジェクトは bless されたデータへのリファレンス>
+
+=begin original
+
 and an arithmetic metaphor:
 
+=end original
+
+そして算術の比喩はこれです:
+
+=begin original
+
 I<  object is a thing by itself>.
 
+=end original
+
+I<  オブジェクトはそれ自体が一つのもの>。
+
+=begin original
+
 The I<main> problem of overloading C<=> is the fact that these metaphors
 imply different actions on the assignment C<$a = $b> if $a and $b are
 objects.  Perl-think implies that $a becomes a reference to whatever
@@ -1241,11 +1630,45 @@
 $a is changed to become the value of the object $b, preserving the fact
 that $a and $b are separate entities.
 
+=end original
+
+C<=> をオーバーロードする I<主な> 問題は、$a と $b がオブジェクトのとき、
+C<$a = $b> という代入はこれらの比喩からは異なった動作を暗示するという
+事実です。
+Perl 的な考え方は、$a は $b がリファレンスしている何かへのリファレンスに
+なることを暗示します。
+算術的な考え方は、$a と $b が別々の実体であることは維持したまま、
+「オブジェクト」$a の値は、オブジェクト $b の値になることを暗示します。
+
+=begin original
+
 The difference is not relevant in the absence of mutators.  After
 a Perl-way assignment an operation which mutates the data referenced by $a
 would change the data referenced by $b too.  Effectively, after
 C<$a = $b> values of $a and $b become I<indistinguishable>.
 
+=end original
+
+ミューテータがないなら、これは違いはありません。
+After
+a Perl-way assignment an operation which mutates the data referenced by $a
+would change the data referenced by $b too.
+Effectively, C<$a = $b> の後では $a と $b の値は I<区別ができない> ものに
+なります。.
+(TBT)
+
+=begin original
+
+On the other hand, anyone who has used algebraic notation knows the
+expressive power of the arithmetic metaphor.  Overloading works hard
+to enable this metaphor while preserving the Perlian way as far as
+possible.  Since it is not not possible to freely mix two contradicting
+metaphors, overloading allows the arithmetic way to write things I<as
+far as all the mutators are called via overloaded access only>.  The
+way it is done is described in L<Copy Constructor>.
+
+=end original
+
 On the other hand, anyone who has used algebraic notation knows the
 expressive power of the arithmetic metaphor.  Overloading works hard
 to enable this metaphor while preserving the Perlian way as far as
@@ -1253,11 +1676,20 @@
 metaphors, overloading allows the arithmetic way to write things I<as
 far as all the mutators are called via overloaded access only>.  The
 way it is done is described in L<Copy Constructor>.
+(TBT)
+
+=begin original
 
 If some mutator methods are directly applied to the overloaded values,
 one may need to I<explicitly unlink> other values which references the
 same value:
 
+=end original
+
+あるミューテータメソッドがオーバーロードされた値に直接適用される場合、
+同じ値をリファレンスしているほかの値と I<明示的にリンクを切る> 必要が
+あるかもしれません:
+
     $a = new Data 23;
     ...
     $b = $a;		# $b is "linked" to $a
@@ -1265,17 +1697,31 @@
     $a = $a->clone;	# Unlink $b from $a
     $a->increment_by(4);
 
+=begin original
+
 Note that overloaded access makes this transparent:
 
+=end original
+
+オーバーロードされたアクセスはこれを透過的にすることに注意してください:
+
     $a = new Data 23;
     $b = $a;		# $b is "linked" to $a
     $a += 4;		# would unlink $b automagically
 
+=begin original
+
 However, it would not make
 
+=end original
+
+しかし、以下のようにしても、
+
     $a = new Data 23;
     $a = 4;		# Now $a is a plain 4, not 'Data'
 
+=begin original
+
 preserve "objectness" of $a.  But Perl I<has> a way to make assignments
 to an object do whatever you want.  It is just not the overload, but
 tie()ing interface (see L<perlfunc/tie>).  Adding a FETCH() method
@@ -1283,16 +1729,52 @@
 value of the object, one can reproduce the arithmetic metaphor in its
 completeness, at least for variables which were tie()d from the start.
 
+=end original
+
+$a の「オブジェクト性」は保存されません。
+But Perl I<has> a way to make assignments
+to an object do whatever you want.
+これは単にオーバーロードではなく、tie() するインターフェースです
+(L<perlfunc/tie> を参照してください)。
+Adding a FETCH() method
+which returns the object itself, and STORE() method which changes the
+value of the object, one can reproduce the arithmetic metaphor in its
+completeness, at least for variables which were tie()d from the start.
+(TBT)
+
+=begin original
+
 (Note that a workaround for a bug may be needed, see L<"BUGS">.)
 
+=end original
+
+(このバグの回避策が必要かもしれないことに注意してください; L<"BUGS"> を
+参照してください。)
+
 =head1 Cookbook
 
+(レシピ集)
+
+=begin original
+
 Please add examples to what follows!
 
+=end original
+
+どうかこれに引き続く例を追加してください!
+
 =head2 Two-face scalars
 
+(2 面スカラ)
+
+=begin original
+
 Put this in F<two_face.pm> in your Perl library directory:
 
+=end original
+
+これを F<two_face.pm> として Perl ライブラリディレクトリに置きます:
+
   package two_face;		# Scalars with separate string and
                                 # numeric values.
   sub new { my $p = shift; bless [@_], $p }
@@ -1300,26 +1782,50 @@
   sub num {shift->[1]}
   sub str {shift->[0]}
 
+=begin original
+
 Use it as follows:
 
+=end original
+
+以下のようにして使います:
+
   require two_face;
   my $seven = new two_face ("vii", 7);
   printf "seven=$seven, seven=%d, eight=%d\n", $seven, $seven+1;
   print "seven contains `i'\n" if $seven =~ /i/;
 
+=begin original
+
 (The second line creates a scalar which has both a string value, and a
 numeric value.)  This prints:
 
+=end original
+
+(2 行目は文字列値と数値の両方を持つスカラを作ります。)
+これは以下を出力します:
+
   seven=vii, seven=7, eight=8
   seven contains `i'
 
 =head2 Two-face references
 
+=begin original
+
+Suppose you want to create an object which is accessible as both an
+array reference and a hash reference, similar to the
+L<pseudo-hash|perlref/"Pseudo-hashes: Using an array as a hash">
+builtin Perl type.  Let's make it better than a pseudo-hash by
+allowing index 0 to be treated as a normal element.
+
+=end original
+
 Suppose you want to create an object which is accessible as both an
 array reference and a hash reference, similar to the
 L<pseudo-hash|perlref/"Pseudo-hashes: Using an array as a hash">
 builtin Perl type.  Let's make it better than a pseudo-hash by
 allowing index 0 to be treated as a normal element.
+(TBT)
 
   package two_refs;
   use overload '%{}' => \&gethash, '@{}' => sub { $ {shift()} };
@@ -1351,28 +1857,67 @@
     $$self->[$key];
   }
 
+=begin original
+
+Now one can access an object using both the array and hash syntax:
+
+=end original
+
 Now one can access an object using both the array and hash syntax:
+(TBT)
 
   my $bar = new two_refs 3,4,5,6;
   $bar->[2] = 11;
   $bar->{two} == 11 or die 'bad hash fetch';
 
+=begin original
+
+Note several important features of this example.  First of all, the
+I<actual> type of $bar is a scalar reference, and we do not overload
+the scalar dereference.  Thus we can get the I<actual> non-overloaded
+contents of $bar by just using C<$$bar> (what we do in functions which
+overload dereference).  Similarly, the object returned by the
+TIEHASH() method is a scalar reference.
+
+=end original
+
 Note several important features of this example.  First of all, the
 I<actual> type of $bar is a scalar reference, and we do not overload
 the scalar dereference.  Thus we can get the I<actual> non-overloaded
 contents of $bar by just using C<$$bar> (what we do in functions which
 overload dereference).  Similarly, the object returned by the
 TIEHASH() method is a scalar reference.
+(TBT)
+
+=begin original
+
+Second, we create a new tied hash each time the hash syntax is used.
+This allows us not to worry about a possibility of a reference loop,
+would would lead to a memory leak.
+
+=end original
 
 Second, we create a new tied hash each time the hash syntax is used.
 This allows us not to worry about a possibility of a reference loop,
 would would lead to a memory leak.
+(TBT)
+
+=begin original
+
+Both these problems can be cured.  Say, if we want to overload hash
+dereference on a reference to an object which is I<implemented> as a
+hash itself, the only problem one has to circumvent is how to access
+this I<actual> hash (as opposed to the I<virtual> hash exhibited by the
+overloaded dereference operator).  Here is one possible fetching routine:
+
+=end original
 
 Both these problems can be cured.  Say, if we want to overload hash
 dereference on a reference to an object which is I<implemented> as a
 hash itself, the only problem one has to circumvent is how to access
 this I<actual> hash (as opposed to the I<virtual> hash exhibited by the
 overloaded dereference operator).  Here is one possible fetching routine:
+(TBT)
 
   sub access_hash {
     my ($self, $key) = (shift, shift);
@@ -1383,8 +1928,16 @@
     $out;
   }
 
+=begin original
+
+To remove creation of the tied hash on each access, one may an extra
+level of indirection which allows a non-circular structure of references:
+
+=end original
+
 To remove creation of the tied hash on each access, one may an extra
 level of indirection which allows a non-circular structure of references:
+(TBT)
 
   package two_refs1;
   use overload '%{}' => sub { ${shift()}->[1] },
@@ -1420,23 +1973,50 @@
     $a->[$key];
   }
 
+=begin original
+
 Now if $baz is overloaded like this, then C<$baz> is a reference to a
 reference to the intermediate array, which keeps a reference to an
 actual array, and the access hash.  The tie()ing object for the access
 hash is a reference to a reference to the actual array, so
 
+=end original
+
+Now if $baz is overloaded like this, then C<$baz> is a reference to a
+reference to the intermediate array, which keeps a reference to an
+actual array, and the access hash.  The tie()ing object for the access
+hash is a reference to a reference to the actual array, so
+(TBT)
+
 =over
 
 =item *
 
+=begin original
+
+There are no loops of references.
+
+=end original
+
 There are no loops of references.
+(TBT)
 
 =item *
 
+=begin original
+
+Both "objects" which are blessed into the class C<two_refs1> are
+references to a reference to an array, thus references to a I<scalar>.
+Thus the accessor expression C<$$foo-E<gt>[$ind]> involves no
+overloaded operations.
+
+=end original
+
 Both "objects" which are blessed into the class C<two_refs1> are
 references to a reference to an array, thus references to a I<scalar>.
 Thus the accessor expression C<$$foo-E<gt>[$ind]> involves no
 overloaded operations.
+(TBT)
 
 =back
 
@@ -1460,15 +2040,35 @@
     bless [$meth, $obj, $other];
   }
 
+=begin original
+
+This module is very unusual as overloaded modules go: it does not
+provide any usual overloaded operators, instead it provides the L<Last
+Resort> operator C<nomethod>.  In this example the corresponding
+subroutine returns an object which encapsulates operations done over
+the objects: C<new symbolic 3> contains C<['n', 3]>, C<2 + new
+symbolic 3> contains C<['+', 2, ['n', 3]]>.
+
+=end original
+
 This module is very unusual as overloaded modules go: it does not
 provide any usual overloaded operators, instead it provides the L<Last
 Resort> operator C<nomethod>.  In this example the corresponding
 subroutine returns an object which encapsulates operations done over
 the objects: C<new symbolic 3> contains C<['n', 3]>, C<2 + new
 symbolic 3> contains C<['+', 2, ['n', 3]]>.
+(TBT)
+
+=begin original
+
+Here is an example of the script which "calculates" the side of
+circumscribed octagon using the above package:
+
+=end original
 
 Here is an example of the script which "calculates" the side of
 circumscribed octagon using the above package:
+(TBT)
 
   require symbolic;
   my $iter = 1;			# 2**($iter+2) = 8
@@ -1480,36 +2080,90 @@
   }
   print "OK\n";
 
+=begin original
+
+The value of $side is
+
+=end original
+
 The value of $side is
+(TBT)
 
   ['/', ['-', ['sqrt', ['+', 1, ['**', ['n', 1], 2]],
 	               undef], 1], ['n', 1]]
 
+=begin original
+
 Note that while we obtained this value using a nice little script,
 there is no simple way to I<use> this value.  In fact this value may
 be inspected in debugger (see L<perldebug>), but ony if
 C<bareStringify> B<O>ption is set, and not via C<p> command.
 
+=end original
+
+Note that while we obtained this value using a nice little script,
+there is no simple way to I<use> this value.  In fact this value may
+be inspected in debugger (see L<perldebug>), but ony if
+C<bareStringify> B<O>ption is set, and not via C<p> command.
+(TBT)
+
+=begin original
+
 If one attempts to print this value, then the overloaded operator
 C<""> will be called, which will call C<nomethod> operator.  The
 result of this operator will be stringified again, but this result is
 again of type C<symbolic>, which will lead to an infinite loop.
 
-Add a pretty-printer method to the module F<symbolic.pm>:
+=end original
 
-  sub pretty {
-    my ($meth, $a, $b) = @{+shift};
-    $a = 'u' unless defined $a;
-    $b = 'u' unless defined $b;
-    $a = $a->pretty if ref $a;
+If one attempts to print this value, then the overloaded operator
+C<""> will be called, which will call C<nomethod> operator.  The
+result of this operator will be stringified again, but this result is
+again of type C<symbolic>, which will lead to an infinite loop.
+(TBT)
+
+=begin original
+
+Add a pretty-printer method to the module F<symbolic.pm>:
+
+=end original
+
+Add a pretty-printer method to the module F<symbolic.pm>:
+(TBT)
+
+  sub pretty {
+    my ($meth, $a, $b) = @{+shift};
+    $a = 'u' unless defined $a;
+    $b = 'u' unless defined $b;
+    $a = $a->pretty if ref $a;
     $b = $b->pretty if ref $b;
     "[$meth $a $b]";
   }
 
+=begin original
+
 Now one can finish the script by
 
+=end original
+
+Now one can finish the script by
+(TBT)
+
   print "side = ", $side->pretty, "\n";
 
+=begin original
+
+The method C<pretty> is doing object-to-string conversion, so it
+is natural to overload the operator C<""> using this method.  However,
+inside such a method it is not necessary to pretty-print the
+I<components> $a and $b of an object.  In the above subroutine
+C<"[$meth $a $b]"> is a catenation of some strings and components $a
+and $b.  If these components use overloading, the catenation operator
+will look for an overloaded operator C<.>; if not present, it will
+look for an overloaded operator C<"">.  Thus it is enough to use
+
+=end original
+
 The method C<pretty> is doing object-to-string conversion, so it
 is natural to overload the operator C<""> using this method.  However,
 inside such a method it is not necessary to pretty-print the
@@ -1518,6 +2172,7 @@
 and $b.  If these components use overloading, the catenation operator
 will look for an overloaded operator C<.>; if not present, it will
 look for an overloaded operator C<"">.  Thus it is enough to use
+(TBT)
 
   use overload nomethod => \&wrap, '""' => \&str;
   sub str {
@@ -1527,20 +2182,62 @@
     "[$meth $a $b]";
   }
 
+=begin original
+
 Now one can change the last line of the script to
 
+=end original
+
+Now one can change the last line of the script to
+(TBT)
+
   print "side = $side\n";
 
+=begin original
+
+which outputs
+
+=end original
+
 which outputs
+(TBT)
 
   side = [/ [- [sqrt [+ 1 [** [n 1 u] 2]] u] 1] [n 1 u]]
 
+=begin original
+
 and one can inspect the value in debugger using all the possible
 methods.
 
+=end original
+
+and one can inspect the value in debugger using all the possible
+methods.
+(TBT)
+
+=begin original
+
+Something is is still amiss: consider the loop variable $cnt of the
+script.  It was a number, not an object.  We cannot make this value of
+type C<symbolic>, since then the loop will not terminate.
+
+=end original
+
 Something is is still amiss: consider the loop variable $cnt of the
 script.  It was a number, not an object.  We cannot make this value of
 type C<symbolic>, since then the loop will not terminate.
+(TBT)
+
+=begin original
+
+Indeed, to terminate the cycle, the $cnt should become false.
+However, the operator C<bool> for checking falsity is overloaded (this
+time via overloaded C<"">), and returns a long string, thus any object
+of type C<symbolic> is true.  To overcome this, we need a way to
+compare an object to 0.  In fact, it is easier to write a numeric
+conversion routine.
+
+=end original
 
 Indeed, to terminate the cycle, the $cnt should become false.
 However, the operator C<bool> for checking falsity is overloaded (this
@@ -1548,10 +2245,19 @@
 of type C<symbolic> is true.  To overcome this, we need a way to
 compare an object to 0.  In fact, it is easier to write a numeric
 conversion routine.
+(TBT)
+
+=begin original
 
 Here is the text of F<symbolic.pm> with such a routine added (and
 slightly modified str()):
 
+=end original
+
+Here is the text of F<symbolic.pm> with such a routine added (and
+slightly modified str()):
+(TBT)
+
   package symbolic;		# Primitive symbolic calculator
   use overload
     nomethod => \&wrap, '""' => \&str, '0+' => \&num;
@@ -1588,12 +2294,29 @@
     $subr->($a,$b);
   }
 
+=begin original
+
+All the work of numeric conversion is done in %subr and num().  Of
+course, %subr is not complete, it contains only operators used in the
+example below.  Here is the extra-credit question: why do we need an
+explicit recursion in num()?  (Answer is at the end of this section.)
+
+=end original
+
 All the work of numeric conversion is done in %subr and num().  Of
 course, %subr is not complete, it contains only operators used in the
 example below.  Here is the extra-credit question: why do we need an
 explicit recursion in num()?  (Answer is at the end of this section.)
+(TBT)
+
+=begin original
+
+Use this module like this:
+
+=end original
 
 Use this module like this:
+(TBT)
 
   require symbolic;
   my $iter = new symbolic 2;	# 16-gon
@@ -1607,20 +2330,45 @@
   printf "%s=%f\n", $side, $side;
   printf "pi=%f\n", $side*(2**($iter+2));
 
+=begin original
+
+It prints (without so many line breaks)
+
+=end original
+
 It prints (without so many line breaks)
+(TBT)
 
   [/ [- [sqrt [+ 1 [** [/ [- [sqrt [+ 1 [** [n 1] 2]]] 1]
 			  [n 1]] 2]]] 1]
      [/ [- [sqrt [+ 1 [** [n 1] 2]]] 1] [n 1]]]=0.198912
   pi=3.182598
 
+=begin original
+
+The above module is very primitive.  It does not implement
+mutator methods (C<++>, C<-=> and so on), does not do deep copying
+(not required without mutators!), and implements only those arithmetic
+operations which are used in the example.
+
+=end original
+
 The above module is very primitive.  It does not implement
 mutator methods (C<++>, C<-=> and so on), does not do deep copying
 (not required without mutators!), and implements only those arithmetic
 operations which are used in the example.
+(TBT)
+
+=begin original
+
+To implement most arithmetic operations is easy; one should just use
+the tables of operations, and change the code which fills %subr to
+
+=end original
 
 To implement most arithmetic operations is easy; one should just use
 the tables of operations, and change the code which fills %subr to
+(TBT)
 
   my %subr = ( 'n' => sub {$_[0]} );
   foreach my $op (split " ", $overload::ops{with_assign}) {
@@ -1635,38 +2383,89 @@
     $subr{$op} = eval "sub {$op shift()}";
   }
 
+=begin original
+
 Due to L<Calling Conventions for Mutators>, we do not need anything
 special to make C<+=> and friends work, except filling C<+=> entry of
 %subr, and defining a copy constructor (needed since Perl has no
 way to know that the implementation of C<'+='> does not mutate
 the argument, compare L<Copy Constructor>).
 
+=end original
+
+Due to L<Calling Conventions for Mutators>, we do not need anything
+special to make C<+=> and friends work, except filling C<+=> entry of
+%subr, and defining a copy constructor (needed since Perl has no
+way to know that the implementation of C<'+='> does not mutate
+the argument, compare L<Copy Constructor>).
+(TBT)
+
+=begin original
+
 To implement a copy constructor, add C<< '=' => \&cpy >> to C<use overload>
 line, and code (this code assumes that mutators change things one level
 deep only, so recursive copying is not needed):
 
+=end original
+
+To implement a copy constructor, add C<< '=' => \&cpy >> to C<use overload>
+line, and code (this code assumes that mutators change things one level
+deep only, so recursive copying is not needed):
+(TBT)
+
   sub cpy {
     my $self = shift;
     bless [@$self], ref $self;
   }
 
+=begin original
+
+To make C<++> and C<--> work, we need to implement actual mutators,
+either directly, or in C<nomethod>.  We continue to do things inside
+C<nomethod>, thus add
+
+=end original
+
 To make C<++> and C<--> work, we need to implement actual mutators,
 either directly, or in C<nomethod>.  We continue to do things inside
 C<nomethod>, thus add
+(TBT)
 
     if ($meth eq '++' or $meth eq '--') {
       @$obj = ($meth, (bless [@$obj]), 1); # Avoid circular referencen
       return $obj;
     }
 
+=begin original
+
+after the first line of wrap().  This is not a most effective
+implementation, one may consider
+
+=end original
+
 after the first line of wrap().  This is not a most effective
 implementation, one may consider
+(TBT)
 
   sub inc { $_[0] = bless ['++', shift, 1]; }
 
+=begin original
+
+instead.
+
+=end original
+
 instead.
+(TBT)
+
+=begin original
+
+As a final remark, note that one can fill %subr by
+
+=end original
 
 As a final remark, note that one can fill %subr by
+(TBT)
 
   my %subr = ( 'n' => sub {$_[0]} );
   foreach my $op (split " ", $overload::ops{with_assign}) {
@@ -1682,9 +2481,20 @@
   $subr{'++'} = $subr{'+'};
   $subr{'--'} = $subr{'-'};
 
+=begin original
+
+This finishes implementation of a primitive symbolic calculator in
+50 lines of Perl code.  Since the numeric values of subexpressions
+are not cached, the calculator is very slow.
+
+=end original
+
 This finishes implementation of a primitive symbolic calculator in
 50 lines of Perl code.  Since the numeric values of subexpressions
 are not cached, the calculator is very slow.
+(TBT)
+
+=begin original
 
 Here is the answer for the exercise: In the case of str(), we need no
 explicit recursion since the overloaded C<.>-operator will fall back
@@ -1694,20 +2504,61 @@
 would convert C<['+', $a, $b]> to C<$a + $b>, which would just rebuild
 the argument of num().
 
+=end original
+
+Here is the answer for the exercise: In the case of str(), we need no
+explicit recursion since the overloaded C<.>-operator will fall back
+to an existing overloaded operator C<"">.  Overloaded arithmetic
+operators I<do not> fall back to numeric conversion if C<fallback> is
+not explicitly requested.  Thus without an explicit recursion num()
+would convert C<['+', $a, $b]> to C<$a + $b>, which would just rebuild
+the argument of num().
+(TBT)
+
+=begin original
+
+If you wonder why defaults for conversion are different for str() and
+num(), note how easy it was to write the symbolic calculator.  This
+simplicity is due to an appropriate choice of defaults.  One extra
+note: due to the explicit recursion num() is more fragile than sym():
+we need to explicitly check for the type of $a and $b.  If components
+$a and $b happen to be of some related type, this may lead to problems.
+
+=end original
+
 If you wonder why defaults for conversion are different for str() and
 num(), note how easy it was to write the symbolic calculator.  This
 simplicity is due to an appropriate choice of defaults.  One extra
 note: due to the explicit recursion num() is more fragile than sym():
 we need to explicitly check for the type of $a and $b.  If components
 $a and $b happen to be of some related type, this may lead to problems.
+(TBT)
 
 =head2 I<Really> symbolic calculator
 
+(I<本当に> シンボリックな計算機)
+
+=begin original
+
 One may wonder why we call the above calculator symbolic.  The reason
 is that the actual calculation of the value of expression is postponed
 until the value is I<used>.
 
+=end original
+
+One may wonder why we call the above calculator symbolic.  The reason
+is that the actual calculation of the value of expression is postponed
+until the value is I<used>.
+(TBT)
+
+=begin original
+
+To see it in action, add a method
+
+=end original
+
 To see it in action, add a method
+(TBT)
 
   sub STORE {
     my $obj = shift;
@@ -1715,27 +2566,64 @@
     @$obj->[0,1] = ('=', shift);
   }
 
+=begin original
+
 to the package C<symbolic>.  After this change one can do
 
+=end original
+
+to the package C<symbolic>.  After this change one can do
+(TBT)
+
   my $a = new symbolic 3;
   my $b = new symbolic 4;
   my $c = sqrt($a**2 + $b**2);
 
+=begin original
+
+and the numeric value of $c becomes 5.  However, after calling
+
+=end original
+
 and the numeric value of $c becomes 5.  However, after calling
+(TBT)
 
   $a->STORE(12);  $b->STORE(5);
 
+=begin original
+
+the numeric value of $c becomes 13.  There is no doubt now that the module
+symbolic provides a I<symbolic> calculator indeed.
+
+=end original
+
 the numeric value of $c becomes 13.  There is no doubt now that the module
 symbolic provides a I<symbolic> calculator indeed.
+(TBT)
+
+=begin original
+
+To hide the rough edges under the hood, provide a tie()d interface to the
+package C<symbolic> (compare with L<Metaphor clash>).  Add methods
+
+=end original
 
 To hide the rough edges under the hood, provide a tie()d interface to the
 package C<symbolic> (compare with L<Metaphor clash>).  Add methods
+(TBT)
 
   sub TIESCALAR { my $pack = shift; $pack->new(@_) }
   sub FETCH { shift }
   sub nop {  }		# Around a bug
 
+=begin original
+
+(the bug is described in L<"BUGS">).  One can use this new interface as
+
+=end original
+
 (the bug is described in L<"BUGS">).  One can use this new interface as
+(TBT)
 
   tie $a, 'symbolic', 3;
   tie $b, 'symbolic', 4;
@@ -1743,13 +2631,27 @@
 
   my $c = sqrt($a**2 + $b**2);
 
+=begin original
+
+Now numeric value of $c is 5.  After C<$a = 12; $b = 5> the numeric value
+of $c becomes 13.  To insulate the user of the module add a method
+
+=end original
+
 Now numeric value of $c is 5.  After C<$a = 12; $b = 5> the numeric value
 of $c becomes 13.  To insulate the user of the module add a method
+(TBT)
 
   sub vars { my $p = shift; tie($_, $p), $_->nop foreach @_; }
 
+=begin original
+
 Now
 
+=end original
+
+ここで
+
   my ($a, $b);
   symbolic->vars($a, $b);
   my $c = sqrt($a**2 + $b**2);
@@ -1760,9 +2662,15 @@
   $a = 12; $b = 5;
   printf "c13  %s=%f\n", $c, $c;
 
+=begin original
+
 shows that the numeric value of $c follows changes to the values of $a
 and $b.
 
+=end original
+
+とすると、$c の数値は $a と $b の値の変更に従います。
+
 =head1 AUTHOR
 
 Ilya Zakharevich E<lt>F<ilya****@math*****>E<gt>.
@@ -1777,7 +2685,19 @@
 =end original
 
 Perl を B<-Do> スイッチか同等のものを使って起動すると、
-多重定義が、診断メッセージを誘発します。
+オーバーロードによって診断メッセージを引き起こします。
+
+=begin original
+
+Using the C<m> command of Perl debugger (see L<perldebug>) one can
+deduce which operations are overloaded (and which ancestor triggers
+this overloading). Say, if C<eq> is overloaded, then the method C<(eq>
+is shown by debugger. The method C<()> corresponds to the C<fallback>
+key (in fact a presence of this method shows that this package has
+overloading enabled, and it is what is used by the C<Overloaded>
+function of module C<overload>).
+
+=end original
 
 Using the C<m> command of Perl debugger (see L<perldebug>) one can
 deduce which operations are overloaded (and which ancestor triggers
@@ -1786,26 +2706,54 @@
 key (in fact a presence of this method shows that this package has
 overloading enabled, and it is what is used by the C<Overloaded>
 function of module C<overload>).
+(TBT)
+
+=begin original
 
 The module might issue the following warnings:
 
+=end original
+
+このモジュールは以下の警告を出すことがあります:
+
 =over 4
 
 =item Odd number of arguments for overload::constant
 
+=begin original
+
 (W) The call to overload::constant contained an odd number of arguments.
 The arguments should come in pairs.
 
+=end original
+
+(W) 奇数の数の引数で overload::constant を呼び出しました。
+引数はペアになっている必要があります。
+
 =item `%s' is not an overloadable type
 
+=begin original
+
 (W) You tried to overload a constant type the overload package is unaware of.
 
+=end original
+
+(W) オーバーロードパッケージが知らない定数型をオーバーロードしようとしました。
+
 =item `%s' is not a code reference
 
+=begin original
+
 (W) The second (fourth, sixth, ...) argument of overload::constant needs
 to be a code reference. Either an anonymous subroutine, or a reference
 to a subroutine.
 
+=end original
+
+(W) overload::constant の 2 番目 (4 番目、6 番目, ...) の引数はコード
+リファレンスである必要があります。
+無名サブルーチンか、サブルーチンへのリファレンスです。
+
 =back
 
 =head1 BUGS
@@ -1818,28 +2766,70 @@
 
 =end original
 
-多重定義に使用されるため、Perl では、ハッシュ %OVERLOAD は、
+オーバーロードに使用されるため、Perl では、ハッシュ %OVERLOAD は、
 パッケージごとに特別な意味を持つことになります。
 シンボルテーブルはごみのように見える名前で埋められます。
 
+=begin original
+
 For the purpose of inheritance every overloaded package behaves as if
 C<fallback> is present (possibly undefined). This may create
 interesting effects if some package is not overloaded, but inherits
 from two overloaded packages.
 
+=end original
+
+継承の目的のために、全てのオーバーロードされたパッケージは
+(未定義かもしれない) C<fallback> が存在するかのように振る舞います。
+これは、あるパッケージがオーバーロードしていないけれども、
+2 つのオーバーロードしたパッケージを継承しているという場合に、
+興味深い効果を作り出します。
+
+=begin original
+
 Relation between overloading and tie()ing is broken.  Overloading is
 triggered or not basing on the I<previous> class of tie()d value.
 
+=end original
+
+オーバーロードと tie() の関係は壊れています。
+オーバーロードは tie() された値の I<以前の> クラスによって
+引き起こされるかどうかが決まります。
+
+=begin original
+
 This happens because the presence of overloading is checked too early,
 before any tie()d access is attempted.  If the FETCH()ed class of the
 tie()d value does not change, a simple workaround is to access the value
 immediately after tie()ing, so that after this call the I<previous> class
 coincides with the current one.
 
+=end original
+
+これは、オーバーロードの存在のチェックが早すぎて、tie() したアクセスを
+試みる前に行われるために起こります。
+If the FETCH()ed class of the
+tie()d value does not change, a simple workaround is to access the value
+immediately after tie()ing, so that after this call the I<previous> class
+coincides with the current one.
+(TBT)
+
+=begin original
+
 B<Needed:> a way to fix this without a speed penalty.
 
+=end original
+
+B<必要:> 速度に影響を与えることなくこれを修正する方法。
+
+=begin original
+
 Barewords are not covered by overloaded string constants.
 
+=end original
+
+裸の単語はオーバーロードされた文字列定数の対象となりません。
+
 =begin original
 
 This document is confusing.  There are grammos and misleading language
@@ -1850,4 +2840,12 @@
 このドキュメントは混乱しています。あちこちに
 誤解しやすい文章があります。完全な書き直しが必要です。
 
+=begin meta
+
+Translate: 吉村 寿人 <JAE00****@nifty*****> (5.000)
+Update: Kentaro Shirakata <argra****@ub32*****> (5.6.1-)
+License: GPL or Artistic
+
+=end meta
+
 =cut



perldocjp-cvs メーリングリストの案内
Back to archive index