Re: problams with IO::Socket::INET

John Redford (garrow@tiac.net)
Tue, 27 Jan 1998 21:50:53 -0500


Tom Christiansen wrote:
> 
> Could he who is enamoured of ->new() as a name please chime in?
> 
> --tom

Since you're asking for it.

I dont use the 'X->new()' syntax; I use 'new X()'.

Perhaps I like 'new' because the use of another name
results in a pointless warning message.

Perhaps I like new because:
 $a = new X();
 $a->logto("mylog");
 $a->connect("a");
 ...
 $a->close();
 $a->connect("b");
 ...
 $a->close();
allows the resource to be abstracted beyond the simple activity of the
moment. Why force my application into messy garbage collections,
when I'm gonna need another thing JUST like that one only a moment
after I finish with the first? And I can keep all the nifty 
side-effects (like logging) active without having to reestablish
them. 

Just think of all the _efficient_ perl code I cant write, because
some author has decided I need to garbage collect his objects to no
point, and reconfigure the objects every time I create them.

Given that good design concept (regardless of present implementation)
I'd keep the constructor name 'new'. (But I'd get rid of the goofy
warning, because I dont have the ego to think that "its a good idea"
justifies preventing you from doing whatever you want).

--
John Redford
GArrow