[Israel.pm] function prototypes

Mikhael Goikhman migo at homemail.com
Wed Jun 11 12:35:40 PDT 2008

On 11 Jun 2008 06:21:11 -0700, Ephraim Dan wrote:
> > On 11 Jun 2008 11:44:39 +0300, sawyer x wrote:
> > >
> > > There is only one reason to use prototypes and that's for nifty and
> > > nice looking functions that don't require parenthesis
> >
> > Mikhael Goikhman replied:
> > 
> > You forgot to add "IMHO", because without it this claim is false.
> But I find it kind of ironic that you jump on his case about a so-called
> "false claim" that is not only his own opinion (so how can it be
> false?), but is shared by the authors of perl's own documentation.  From
> perldoc perlop:
> "Prototypes
> ...
> Because the intent of this feature is primarily to let you define
> sub-routines that work like built-in functions ..."
> Which is basically what sawyer x said.
> Food for thought.

1. Not requiring parentheses (the original claim) is very different in my
eyes from emulating all perl built-in functions; there is much more in
this than just parentheses.

2. I hope you didn't intend to say that "primarily" and "only one reason"
are the same things. I will allow myself to disagree with such logic.

3. When someone suggests categorical things such like "goto is harmful",
"use warnings; is the only way", "function prototypes are better to
avoid", then I would suggest not to lose your critical thinking and still
learn these tools deeply (that are like all tools are definitely useful
in some situations and less useful in others) to form your own opinions.

Because it's possible one day you may discover cases when "use warnings;"
may stay in your way (say, in short one-liners) or find that "goto" may
actually make your code much more readable in some real-life situations.
Or maybe (god forbid) you will learn the wonderful world of perl function
prototypes and will find their usefulness. :-)


perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'

More information about the Perl mailing list