>>>>> "R" == R Joseph Newton <[EMAIL PROTECTED]> writes:

R> Message-ID:   <[EMAIL PROTECTED]>

R> [Randal]
R> ...
R> The point is that

R>         $instance->new

R> could mean either "clone", or "make one of the same class as".  You
R> don't need it for "make one of the same class as", because you've got:

R>         (ref $instance)->new

R> to do that explicitly.  And if you really wanted that to do clone,
R> CALL IT CLONE, don't call it ->new.

R> It obscures more than it clarifies, and hence is a *bad* name
R> for an instance method.
R> ...
R> [/Randal]

Thanks for reposting that.  I'm unwavering on this.  I've heard
all counter arguments, and am unconvinced.  So I continue to argue
that ->new is a *class* method only.

This is not to say that I believe methods can't be both class and
instance methods.  In "perldoc perlboot", I show a sensible use
of such methods.

It's just that particularly, ->new on an instance can mean either
"clone" or "make an empty one of the same class as", and since
it can easily mean either, it's best not to burden ->new with
double duty when it only adds confusion.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to