in reply to Re: Re: where do you put your subs
in thread where do you put your subs
Your analogy doesnt makes sense. The main is in essence the conclusion of an argument. So what you are saying is that when I write an argument I should put the conclusion before the introduction.
Also, you are talking about aesthetic reasons. I am talking about best practice. Best practice is that which minimizes the chance of bugs and error, not that which reads like a novel. If you want to read nice text then read the comments. The code should be written so as to be as maintainable and error free as possible.
And if you rearranged my code as you said there is a very good chance it wouldnt run. I do like not using parens when they arent necessary as they often end up occluding the intent in a mess of parens, much as lisp is practically unreadable for most mere mortals. Consider
Err. maybe not the best example but I know which of the two I find easier to write and to read.print join("\n",map(join(",",map{s/\.//;$_}@$_),@strings); #vs print join "\n",map{join",",map{s/\.//;$_}@$_}@strings;
UPDATE:
A better example is one that we use all the time, that of finding out how many values are in a hash. Which would you rather use
END UPDATEmy $count=scalar keys %hash; #or $count=scalar(keys(%hash));
BTW: I am a Pascal programmer by background. But that is neither here nor there. In C you cant use a sub until it has been declared either,(Both allow the use of forward declarations, as does perl,) in fact most true compiled languages share this trait.
Cheers,
Yves / DeMerphq
--
When to use Prototypes?
Advanced Sorting - GRT - Guttman Rosler Transform
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: where do you put your subs
by derby (Abbot) on Mar 08, 2002 at 14:38 UTC | |
by Juerd (Abbot) on Mar 08, 2002 at 15:52 UTC | |
by dragonchild (Archbishop) on Mar 08, 2002 at 16:44 UTC | |
by Juerd (Abbot) on Mar 08, 2002 at 17:09 UTC |