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)
In reply to Re: Re: Creating objects within objects being strange...
by demerphq
in thread Creating objects within objects being strange...
by Vuud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |