in reply to Re: Re: (cLive ;-) Re: Perl High School
in thread Perl High School
By using indirect notation, you're removing the capability for the interpreter to spellcheck you if you have defined a new function in the current package. My example is contrived, but what if you're creating an object from within another object? That shows up every once in a while, right? :-)package Foo; sub new { print "Right one!\n"; } 1; -------- #!/usr/local/bin/perl use Foo; # Insert 1000 lines of code here sub new { print "Wrong one!\n"; } # Insert 1000 lines of code here my $bar = new FOO; # Compare that with my $bar = FOO->new;
The only reasons I can ever see to use indirect notation are the following:
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 1: Here's a quick example why not to use Indirect notation
by tilly (Archbishop) on Feb 22, 2002 at 23:21 UTC | |
Re: Here's a quick example why not to use Indirect notation
by dws (Chancellor) on Feb 22, 2002 at 17:53 UTC | |
by dragonchild (Archbishop) on Feb 22, 2002 at 18:08 UTC | |
by dws (Chancellor) on Feb 22, 2002 at 18:50 UTC | |
by dragonchild (Archbishop) on Feb 22, 2002 at 19:53 UTC | |
by dws (Chancellor) on Feb 22, 2002 at 21:13 UTC |