On Tue, May 26, 2009 at 2:59 PM, Hans Dieter Pearcey <
hdp.perl.module-auth...@weftsoar.net> wrote:

> On Tue, May 26, 2009 at 05:56:10PM -0400, Daniel Staal wrote:
> > --As of May 26, 2009 12:33:08 PM -0700, Bill Ward is alleged to have
> said:
> >
> >> How would you feel about ref($foo)->new();
> >
> > --As for the rest, it is mine.
> >
> > As a clone?  Off the top of my head, I can't see what's that doing.  A
> > bit of thinking (and reading) about ref() makes it understandable, if not
> > clean.
>
> No, as a way of creating a new object in the same class as an existing
> object.
> The suggestion for a method that clones was $obj->clone.


$foo->new() makes a new object of the same type as $foo.  I suggested
ref($foo) as a more explicit alternative, rather like saying $count =
scalar(@array) instead of just $count = @array to get the number of elements
explicitly rather than implicitly.  Kind of like a (cast) in C.

Reply via email to