Re: problams with IO::Socket::INET

Mark Mielke (markm@nortel.ca)
28 Jan 1998 00:09 EST


In message "Re: problams with IO::Socket::INET", 
'gbarr@pobox.com' writes:

>Tom Christiansen wrote:
>> 
>> >I dont use the 'X->new()' syntax; I use 'new X()'.
>> 
>> That's a mistake, although the docs would lead you to
>> believe otherwise.  That's mostly my fault.  I know
>> better now.  Indirect object notation is flawed.
>
>Why is it a mistake, I too use the new X() form
>
>can you please explain 
>

There's a slight possibility for new() to be called from the current
package instead of as a method from the class. (if memory serves correct)

I (as well as who knows how many others?) still choose to always use:

    $object = new X();

If somebody is gonna go making a new() sub{} then let them screw themselves.
This is another reason why a consistently named constructor is good.
Having a constructor named open for example would just be wierd:

    $object = open X();

Wonder if that would even work? hmm... i should go and test to see what the
above does :-)

    $object = X->new();

Just looks really messy in my opinion. (obfuscated might be the word? :-) )
How would you like to use:

    STDOUT->print("...");

All the time? I think i rest my (our?) case.

mark

--                                                  _________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|