in reply to Re: (jeffa) 5Re: My first stab at OO perl...
in thread My first stab at OO perl...
Personally, I'd go with the last of these. If your constructor contains a bit of unexpected magic, you may as well document it. And if you want to allow for $instance->new(), you'll have to painstakingly document whether this creates a new "empty" object, or whether it creates a copy of the instance it was called on. FWIW, I think of "new" as a class method no matter what, so to my mind providing a way to use new from an instance is just muddying the water.
Notes on reply: my point is that you will need to document this behavior, otherwise there is no reason to include it. And I have no idea what this adds to the module or how it helps programmers. It seems only to add a layer of indirection, which Perl OO already has enough of (imho-- and hopefully this will improve in Perl 6).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: ... Re: My first stab at OO perl...
by Anonymous Monk on Jul 16, 2002 at 23:23 UTC |