in reply to •Re: It's a dog, but what kind? (polymorphism , in Perl OO)
in thread It's a dog, but what kind? (polymorphism , in Perl OO)
my $class=ref($proto)||$proto;
I understand the reasons to avoid this construct.
But if you avoid it, then you need to replace it with something. Unfortunately, although I often see this construct derided, I very seldom see suggestions for what to replace that line with (even when I come out and ask for it). The most straightforward replacement is unacceptable to me. See Re^2: A few Perl OOP questions. (disparaging) for why.
I also consider the objections to this to be rather minor in impact in a lot of practical situations and appreciate the "sloppy" advantages of $obj->new() in a lot of pracitcal situations. So I consider this construct to be a net win for simple OO Perl classes in many cases.
I also provide an alternative to it in (tye)Re: Private Class Methods.
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
•Re: Re^2: It's a dog, but what kind? (polymorphism , in Perl OO)
by merlyn (Sage) on Mar 23, 2004 at 20:58 UTC | |
by tye (Sage) on Mar 23, 2004 at 23:06 UTC | |
by hardburn (Abbot) on Mar 24, 2004 at 14:18 UTC | |
by tye (Sage) on Mar 24, 2004 at 15:41 UTC | |
by merlyn (Sage) on Mar 24, 2004 at 16:25 UTC | |
| |
by hardburn (Abbot) on Mar 24, 2004 at 16:25 UTC |