Perlのクラス継承の限界

| コメント(0) | トラックバック(0)
404 Blog Not Found:perl - POO と goto

ちなみに,暇な人はdepthの指定を100以上にしてみよう。滅多にお目にかかれないものに巡り会える。

暇ではないが、気になったのでdepthを100以上にしてみた。

% perl sample.pl
Benchmark: running Goto, Noself, Return for at least 3 CPU seconds...
Recursive inheritance detected while looking for method '()' in package 'Goto::0' at aa.pl line 77.

お、なんだこれは。再帰継承じゃねーかと言われた。99まではオッケイで、100より上だとこうなる。
調べてみると答えは「perldiag」にあった。

% perldoc perldiag
       …
       Recursive inheritance detected while looking for method %s
           (F) More than 100 levels of inheritance were encountered while invoking a method.
           Probably indicates an unintended loop in your inheritance hierarchy.
       …
100以上の継承をするとそうでるみたい。

ってことはPerlでは100以上の継承ができないってことなのかな。
実際そんなクラス構造を作ることはないとは思うけど…。

トラックバック(0)

トラックバックURL: http://blog.clouder.jp/mt/mt-tb.cgi/870

コメントする

検索

広告

月別 アーカイブ

OpenID対応しています OpenIDについて
Powered by Movable Type 5.12