in reply to Re: Creating objects within objects being strange...
in thread Creating objects within objects being strange...
The notation is easier to read, and less susceptable to errors. Also it is more intuitive. It is clear the function is called is 'new' and that new() resides in the class/package 'MyClass' and that 'MyClass' will be passed to new() as its first parameter, along with the parameters supplied.my $inst=MyClass->new( name => 'mr.nick', rank => 'novice', sleep_level => 'not enough' );
The other notation is much less clear. When I see a bareword followed by parameters in parenthesis my first thought is that it is a function being called. Which is as we all know NOT what is happening.
BTW: This is one of my pet peeves, can you tell? :-)
Yves
--
You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Creating objects within objects being strange...
by mr.nick (Chaplain) on Sep 08, 2001 at 23:10 UTC | |
by demerphq (Chancellor) on Sep 09, 2001 at 16:17 UTC | |
Re: Re: Re: Creating objects within objects being strange...
by Anonymous Monk on Sep 08, 2001 at 01:34 UTC |