in reply to Re: Re: Re: $class = ref $class || $class
in thread Constructor/Factory Orthodoxy
I would prefer to write
(ref $obj)->new
instead of
$obj->new
because that tells the reader that the type of $obj
is variable or questionable. If I write
Obj->new
there is no doubt of the type. There is less chance
the reader will research the wrong package if he wants
to do something with the created object.
If I just write $obj->new as a convenient
shorthand I hide this info. Thus
I make the code more complicated to understand.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Re:) $class = ref $class || $class
by herveus (Prior) on Feb 28, 2003 at 17:13 UTC | |
by rir (Vicar) on Feb 28, 2003 at 21:49 UTC | |
by herveus (Prior) on Mar 03, 2003 at 12:39 UTC | |
by rir (Vicar) on Mar 03, 2003 at 21:35 UTC | |
by herveus (Prior) on Mar 04, 2003 at 12:49 UTC | |
|