in reply to Re^3: bless with => separated args
in thread bless with => separated args
I'd probably expect $foo->new to clone $foo, but if the class author wanted that functionality they should have created an object method called "clone" or something like that.That, I do not understand. If you expect the author to name clone functionality clone, then why assume that new clones the object?
I'd expect something called new to give me a new thing - not a cloned one.
Well, you can always use (ref $foo)->new if that's what you want.That's not much of an argument, is it? With such an argument, we could do away with for/foreach, unless, and/or, q/qq/qw/qx, etc. There are always alternatives taking a few more keystrokes.
And note that the existance of ref $proto || $proto in a constructor doesn't prevent you from writing:
if(ref $foo)->new
confuses you.$foo->new
But the absense of ref $proto || $proto forces someone who doesn't confuse easily to write:
Ergo, using ref $proto || $proto gives the user of the module more choice.(ref $foo)->new
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: bless with => separated args
by davorg (Chancellor) on Aug 01, 2005 at 11:14 UTC | |
by Anonymous Monk on Aug 01, 2005 at 12:02 UTC |