Re: kanjidic parser in Perl?
- From: "John J. Chew, III" <jjchew@xxxxxxxxxxxxxxxx>
- Date: Tue, 16 Aug 2005 16:59:23 -0400
David Alexander Ranvig wrote:
"John J. Chew, III" <jjchew@xxxxxxxxxxxxxxxx> writes:
| > sub kdic::parse_entry
| | sub parse_entry ($) {
| | Always use prototypes.
I believe this advice to be counterproductive.
Tom Christiansen once posted a nice write-up of "prototypes" in perl:
Thanks for posting that. His main beef with prototypes is that they give programmers a false sense of security, because they only catch argument type and number errors under some circumstances and not others.
I should have suggested to Ben in my first message, as I did in my second, that he make a point of including prototyped sub declarations at the beginning of each file. Doing so solves one of Tom's problems by ensuring that prototype checking takes place right from the start of the file, including uses of the sub before it is defined.
I myself have found prototypes to be extremely valuable, and would no more omit them than I would code without "use strict" or "use warnings". It could be because of sloppy coding habits: I'm almost always wrong as to how many arguments the final version of a sub is going to want, and I find it convenient to have Perl tell me when I've been inconsistent.
John -- John Chew <jjchew@xxxxxxxxxxxxxxxx> http://www.poslfit.com .
- References:
- Re: kanjidic parser in Perl?
- From: Gabor Farkas
- Re: kanjidic parser in Perl?
- From: Ben Bullock
- Re: kanjidic parser in Perl?
- From: Gabor Farkas
- Re: kanjidic parser in Perl?
- From: Ben Bullock
- Re: kanjidic parser in Perl?
- From: John J. Chew, III
- Re: kanjidic parser in Perl?
- From: David Alexander Ranvig
- Re: kanjidic parser in Perl?
- Prev by Date: Re: kanjidic parser in Perl?
- Next by Date: Re: chikarazuku vs chikaraduku
- Previous by thread: Re: kanjidic parser in Perl?
- Next by thread: Re: kanjidic parser in Perl?
- Index(es):
Relevant Pages
|